24
|
1 |
|
|
2 |
// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
// All rights reserved.
|
|
4 |
// This component and the accompanying materials are made available
|
|
5 |
// under the terms of "Eclipse Public License v1.0"
|
|
6 |
// which accompanies this distribution, and is available
|
|
7 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
//
|
|
9 |
// Initial Contributors:
|
|
10 |
// Nokia Corporation - initial contribution.
|
|
11 |
//
|
|
12 |
// Contributors:
|
|
13 |
//
|
|
14 |
// Description:
|
|
15 |
// TS_SimPhBk.CPP
|
|
16 |
// This tests the GSM Phone Book functions including phonebook searching.
|
|
17 |
// The PhoneBook search functions are implemented in the T_SEARCH files.
|
|
18 |
//
|
|
19 |
//
|
|
20 |
|
|
21 |
/**
|
|
22 |
@file
|
|
23 |
*/
|
|
24 |
|
|
25 |
#include "Te_SimPhBk.h"
|
|
26 |
#include "Te_SimPhBkConstants.h"
|
|
27 |
|
|
28 |
#define __TEST_CANCEL__
|
|
29 |
|
|
30 |
#define __TEST_WRITE_TO_NEXT_AVAIL__
|
|
31 |
|
|
32 |
|
|
33 |
#define SIM_TSY
|
|
34 |
|
|
35 |
//------------------------------------------------------------------
|
|
36 |
// ** TEST STEPS ***
|
|
37 |
//------------------------------------------------------------------
|
|
38 |
|
|
39 |
CTestPhoneInfo::CTestPhoneInfo()
|
|
40 |
/** Each test step initialises it's own name
|
|
41 |
*/
|
|
42 |
{
|
|
43 |
// store the name of this test case
|
|
44 |
// this is the name that is used by the script file
|
|
45 |
SetTestStepName(_L("testPhoneInfo"));
|
|
46 |
}
|
|
47 |
//------------------------------------------------------------------
|
|
48 |
|
|
49 |
TVerdict CTestPhoneInfo::doTestStepL( void )
|
|
50 |
/**
|
|
51 |
* This function gets information about the phone: the Phone Manufacturer's Id, the
|
|
52 |
* Model and Revision ID, the Serial number and the number of phone books supported,
|
|
53 |
* as well as information associated with each supported phone book.
|
|
54 |
* The functions are called on a RBasicGsmPhone object.
|
|
55 |
*/
|
|
56 |
{
|
|
57 |
RMobilePhone::TMobilePhoneIdentityV1 aPhoneId;
|
|
58 |
TRequestStatus aStatus;
|
|
59 |
RMobilePhoneStore::TMobilePhoneStoreInfoV1 aPhoneStoreInfo;
|
|
60 |
RMobilePhoneStore::TMobilePhoneStoreInfoV1Pckg aPhoneStoreInfoPckg(aPhoneStoreInfo);
|
|
61 |
|
|
62 |
iPhone.GetPhoneId(aStatus, aPhoneId);
|
|
63 |
User::WaitForRequest(aStatus);
|
|
64 |
if(aStatus == KErrNotSupported)
|
|
65 |
{
|
|
66 |
INFO_PRINTF1(_L("iPhone.GetPhoneId(aStatus, aPhoneId) not supported"));
|
|
67 |
}
|
|
68 |
|
|
69 |
iPhone.GetPhoneStoreInfo(aStatus, aPhoneStoreInfoPckg, KETelMeMissedPhoneBook);
|
|
70 |
User::WaitForRequest(aStatus);
|
|
71 |
INFO_PRINTF2(TRefByValue<const TDesC>(_L("Testing \"MISSED_CALLS\" returned %d")), aStatus.Int());
|
|
72 |
if(aStatus.Int() == KErrNone)
|
|
73 |
{
|
|
74 |
aPhoneStoreInfo = aPhoneStoreInfoPckg();
|
|
75 |
CheckPhoneBookInfoL(aPhoneStoreInfo);
|
|
76 |
}
|
|
77 |
else
|
|
78 |
{
|
|
79 |
INFO_PRINTF1(_L("Phone Book \"MISSED_CALLS\" not supported by this phone"));
|
|
80 |
}
|
|
81 |
|
|
82 |
|
|
83 |
iPhone.GetPhoneStoreInfo(aStatus, aPhoneStoreInfoPckg, KETelMeReceivedPhoneBook);
|
|
84 |
User::WaitForRequest(aStatus);
|
|
85 |
INFO_PRINTF2(TRefByValue<const TDesC>(_L("Testing \"RECEIVED_CALLS\" returned %d")), aStatus.Int());
|
|
86 |
if(aStatus.Int() == KErrNone)
|
|
87 |
{
|
|
88 |
aPhoneStoreInfo = aPhoneStoreInfoPckg();
|
|
89 |
CheckPhoneBookInfoL(aPhoneStoreInfo);
|
|
90 |
}
|
|
91 |
else
|
|
92 |
{
|
|
93 |
INFO_PRINTF1(_L("Phone Book \"RECEIVED_CALLS\" not supported by this phone"));
|
|
94 |
}
|
|
95 |
|
|
96 |
iPhone.GetPhoneStoreInfo(aStatus, aPhoneStoreInfoPckg, KETelMeAdnPhoneBook);
|
|
97 |
User::WaitForRequest(aStatus);
|
|
98 |
INFO_PRINTF2(TRefByValue<const TDesC>(_L("Testing \"ME_PHONEBOOK\" returned %d")), aStatus.Int());
|
|
99 |
if(aStatus.Int() == KErrNone)
|
|
100 |
{
|
|
101 |
aPhoneStoreInfo = aPhoneStoreInfoPckg();
|
|
102 |
CheckPhoneBookInfoL(aPhoneStoreInfo);
|
|
103 |
}
|
|
104 |
else
|
|
105 |
{
|
|
106 |
INFO_PRINTF1(_L("Phone Book \"ME_PHONEBOOK\" not supported by this phone"));
|
|
107 |
}
|
|
108 |
|
|
109 |
iPhone.GetPhoneStoreInfo(aStatus, aPhoneStoreInfoPckg, KETelIccVoiceMailBox);
|
|
110 |
User::WaitForRequest(aStatus);
|
|
111 |
INFO_PRINTF2(TRefByValue<const TDesC>(_L("Testing \"VOICE_MAILBOX\" returned %d")), aStatus.Int());
|
|
112 |
if(aStatus.Int() == KErrNone)
|
|
113 |
{
|
|
114 |
aPhoneStoreInfo = aPhoneStoreInfoPckg();
|
|
115 |
CheckPhoneBookInfoL(aPhoneStoreInfo);
|
|
116 |
}
|
|
117 |
else
|
|
118 |
{
|
|
119 |
INFO_PRINTF1(_L("Phone Book \"VOICE_MAILBOX\" not supported by this phone"));
|
|
120 |
}
|
|
121 |
|
|
122 |
iPhone.GetPhoneStoreInfo(aStatus, aPhoneStoreInfoPckg, KETelIccAdnPhoneBook);
|
|
123 |
User::WaitForRequest(aStatus);
|
|
124 |
INFO_PRINTF2(TRefByValue<const TDesC>(_L("Testing \"SIM_PHONEBOOK\" returned %d")), aStatus.Int());
|
|
125 |
if(aStatus.Int() == KErrNone)
|
|
126 |
{
|
|
127 |
aPhoneStoreInfo = aPhoneStoreInfoPckg();
|
|
128 |
CheckPhoneBookInfoL(aPhoneStoreInfo);
|
|
129 |
}
|
|
130 |
else
|
|
131 |
{
|
|
132 |
INFO_PRINTF1(_L("Phone Book \"SIM_PHONEBOOK\" not supported by this phone"));
|
|
133 |
}
|
|
134 |
|
|
135 |
iPhone.GetPhoneStoreInfo(aStatus, aPhoneStoreInfoPckg, KETelCombinedAdnPhoneBook);
|
|
136 |
User::WaitForRequest(aStatus);
|
|
137 |
INFO_PRINTF2(TRefByValue<const TDesC>(_L("Testing \"COMBINED_SIM_ME\" returned %d")), aStatus.Int());
|
|
138 |
if(aStatus.Int() == KErrNone)
|
|
139 |
{
|
|
140 |
aPhoneStoreInfo = aPhoneStoreInfoPckg();
|
|
141 |
CheckPhoneBookInfoL(aPhoneStoreInfo);
|
|
142 |
}
|
|
143 |
else
|
|
144 |
{
|
|
145 |
INFO_PRINTF1(_L("Phone Book \"COMBINED_SIM_ME\" not supported by this phone"));
|
|
146 |
}
|
|
147 |
|
|
148 |
iPhone.GetPhoneStoreInfo(aStatus, aPhoneStoreInfoPckg, KETelIccFdnPhoneBook);
|
|
149 |
User::WaitForRequest(aStatus);
|
|
150 |
INFO_PRINTF2(TRefByValue<const TDesC>(_L("Testing \"FIXED_DIAL_NUM\" returned %d")), aStatus.Int());
|
|
151 |
if(aStatus.Int() == KErrNone)
|
|
152 |
{
|
|
153 |
aPhoneStoreInfo = aPhoneStoreInfoPckg();
|
|
154 |
CheckPhoneBookInfoL(aPhoneStoreInfo);
|
|
155 |
}
|
|
156 |
else
|
|
157 |
{
|
|
158 |
INFO_PRINTF1(_L("Phone Book \"FIXED_DIAL_NUM\" not supported by this phone"));
|
|
159 |
}
|
|
160 |
|
|
161 |
iPhone.GetPhoneStoreInfo(aStatus, aPhoneStoreInfoPckg, KETelIccSdnPhoneBook);
|
|
162 |
User::WaitForRequest(aStatus);
|
|
163 |
INFO_PRINTF2(TRefByValue<const TDesC>(_L("Testing \"SERV_DIAL_NUM\" returned %d")), aStatus.Int());
|
|
164 |
if(aStatus.Int() == KErrNone)
|
|
165 |
{
|
|
166 |
aPhoneStoreInfo = aPhoneStoreInfoPckg();
|
|
167 |
CheckPhoneBookInfoL(aPhoneStoreInfo);
|
|
168 |
}
|
|
169 |
else
|
|
170 |
{
|
|
171 |
INFO_PRINTF1(_L("Phone Book \"SERV_DIAL_NUM\" not supported by this phone"));
|
|
172 |
}
|
|
173 |
|
|
174 |
iPhone.GetPhoneStoreInfo(aStatus, aPhoneStoreInfoPckg, KETelIccBdnPhoneBook);
|
|
175 |
User::WaitForRequest(aStatus);
|
|
176 |
INFO_PRINTF2(TRefByValue<const TDesC>(_L("Testing \"BARRED_DIAL_NUM\" returned %d")), aStatus.Int());
|
|
177 |
if(aStatus.Int() == KErrNone)
|
|
178 |
{
|
|
179 |
aPhoneStoreInfo = aPhoneStoreInfoPckg();
|
|
180 |
CheckPhoneBookInfoL(aPhoneStoreInfo);
|
|
181 |
}
|
|
182 |
else
|
|
183 |
{
|
|
184 |
INFO_PRINTF1(_L("Phone Book \"BARRED_DIAL_NUM\" not supported by this phone"));
|
|
185 |
}
|
|
186 |
return TestStepResult();
|
|
187 |
}
|
|
188 |
//------------------------------------------------------------------
|
|
189 |
|
|
190 |
CTestGetCapsAndInfo::CTestGetCapsAndInfo()
|
|
191 |
/** Each test step initialises it's own name
|
|
192 |
*/
|
|
193 |
{
|
|
194 |
// store the name of this test case
|
|
195 |
// this is the name that is used by the script file
|
|
196 |
SetTestStepName(_L("testGetCapsAndInfo"));
|
|
197 |
}
|
|
198 |
//------------------------------------------------------------------
|
|
199 |
|
|
200 |
TVerdict CTestGetCapsAndInfo::doTestStepL( void )
|
|
201 |
/**
|
|
202 |
* This function gets the SIM phone book's static capabilities (as well as the ME &
|
|
203 |
* MT phone books, if supported), and information associated with the phone book.
|
|
204 |
* It also validates the obtained information.
|
|
205 |
* @test GT83-TPHBK-001.06 Test opening an ICC-based phonebook of abbreviated dialling numbers
|
|
206 |
* @test GT83-TPHBK-002.06 Test closing an ICC-based phonebook of abbreviated dialling numbers
|
|
207 |
* @test GT83-TPHBK-003.04 Test retrieval of the phone book store info and capabilities of an ME-based phonebook of abbreviated dialling numbers.
|
|
208 |
* @test GT83-TPHBK-003.06 Test retrieval of the phone book store info and capabilities of an ICC-based phonebook of abbreviated dialling numbers
|
|
209 |
* @test GT83-TPHBK-003.11 Test retrieval of the phone book store info and capabilities of a combination of the ADN stored in ME and ICC
|
|
210 |
* @test GT83-TPHBK-003.13 Test cancelling a request to retrieve phone book store info and capabilities
|
|
211 |
*/
|
|
212 |
{
|
|
213 |
// SIM phone book - mandatory
|
|
214 |
TInt ret=KErrNone;
|
|
215 |
TRequestStatus aStatus;
|
|
216 |
RMobilePhoneBookStore simPhBk;
|
|
217 |
RMobilePhoneBookStore::TMobilePhoneBookInfoV1 aInfo;
|
|
218 |
RMobilePhoneBookStore::TMobilePhoneBookInfoV1Pckg aInfoPckg(aInfo);
|
|
219 |
RMobilePhoneBookStore::TMobilePhoneBookInfoV1 *aInfob;
|
|
220 |
|
|
221 |
ret=simPhBk.Open(iPhone, KETelIccAdnPhoneBook());
|
|
222 |
if( KErrNone ==ret )
|
|
223 |
{
|
|
224 |
|
|
225 |
CHECKPOINT(ret, KErrNone, _L("GT83-TPHBK-001.06")) ;
|
|
226 |
simPhBk.GetInfo(aStatus, aInfoPckg);
|
|
227 |
User::WaitForRequest(aStatus);
|
|
228 |
CHECKPOINT(aStatus.Int(), KErrNone, _L("GT83-TPHBK-003.06")) ;
|
|
229 |
aInfob = &aInfoPckg();
|
|
230 |
|
|
231 |
//MKV Print_TMobilePhoneBookInfoV1(aInfoPckg()) ;
|
|
232 |
|
|
233 |
TESTL(aInfob->iCaps & RMobilePhoneStore::KCapsWriteAccess);
|
|
234 |
TESTL(!aInfob->iName.Compare(KETelIccAdnPhoneBook()));
|
|
235 |
simPhBk.Close();
|
|
236 |
|
|
237 |
}
|
|
238 |
else
|
|
239 |
{
|
|
240 |
INFO_PRINTF1(_L("Does SIM.TSY support KETelIccAdnPhoneBook?")) ;
|
|
241 |
simPhBk.Close();
|
|
242 |
}
|
|
243 |
|
|
244 |
// ME phone book - optional support by the phones
|
|
245 |
RMobilePhoneBookStore mePhBk;
|
|
246 |
ret=mePhBk.Open(iPhone, KETelMeAdnPhoneBook());
|
|
247 |
|
|
248 |
if (ret==KErrNone)
|
|
249 |
{
|
|
250 |
CHECKPOINT(ret, KErrNone, _L("GT83-TPHBK-001.06")) ;
|
|
251 |
INFO_PRINTF1(_L("ME phonebook supported"));
|
|
252 |
iMESupported=ETrue;
|
|
253 |
|
|
254 |
mePhBk.GetInfo(aStatus, aInfoPckg);
|
|
255 |
User::WaitForRequest(aStatus);
|
|
256 |
CHECKPOINT(aStatus.Int(), KErrNone, _L("GT83-TPHBK-003.04")) ;
|
|
257 |
|
|
258 |
aInfob = &aInfoPckg();
|
|
259 |
|
|
260 |
TESTL(aInfob->iCaps & RMobilePhoneStore::KCapsWriteAccess);
|
|
261 |
TESTL(!aInfob->iName.Compare(KETelMeAdnPhoneBook()));
|
|
262 |
mePhBk.Close();
|
|
263 |
CHECKPOINT(0, KErrNone, _L("GT83-TPHBK-002.06")) ;
|
|
264 |
}
|
|
265 |
else
|
|
266 |
{
|
|
267 |
INFO_PRINTF1(_L("Does SIM.TSY support KETelMeAdnPhoneBook?")) ;
|
|
268 |
mePhBk.Close();
|
|
269 |
}
|
|
270 |
|
|
271 |
// Combined ME and SIM phone book - optional support by the phones
|
|
272 |
if (iMTSupported)
|
|
273 |
{
|
|
274 |
RMobilePhoneBookStore combPhBk;
|
|
275 |
ret=combPhBk.Open(iPhone, KETelCombinedAdnPhoneBook());
|
|
276 |
if (ret==KErrNone)
|
|
277 |
{
|
|
278 |
INFO_PRINTF1(_L("Combined ME & SIM phonebook supported"));
|
|
279 |
iMTSupported=ETrue;
|
|
280 |
|
|
281 |
combPhBk.GetInfo(aStatus, aInfoPckg);
|
|
282 |
User::WaitForRequest(aStatus);
|
|
283 |
CHECKPOINT(aStatus.Int(), KErrNone, _L("GT83-TPHBK-003.11")) ;
|
|
284 |
|
|
285 |
aInfob = &aInfoPckg();
|
|
286 |
|
|
287 |
TESTL(aInfob->iCaps && RMobilePhoneStore::KCapsWriteAccess);
|
|
288 |
TESTL(!aInfob->iName.Compare(KETelCombinedAdnPhoneBook()));
|
|
289 |
}
|
|
290 |
else
|
|
291 |
{
|
|
292 |
INFO_PRINTF1(_L("Does SIM.TSY support KETelCombinedAdnPhoneBook?")) ;
|
|
293 |
}
|
|
294 |
combPhBk.Close();
|
|
295 |
|
|
296 |
// Combined ME and SIM phone book
|
|
297 |
if (iMTSupported)
|
|
298 |
{
|
|
299 |
RMobilePhoneBookStore combPhBk;
|
|
300 |
TESTL(combPhBk.Open(iPhone, KETelCombinedAdnPhoneBook())==KErrNone);
|
|
301 |
|
|
302 |
combPhBk.GetInfo(aStatus, aInfoPckg);
|
|
303 |
User::WaitForRequest(aStatus);
|
|
304 |
CHECKPOINT(aStatus.Int(), KErrNone, _L("GT83-TPHBK-003.11")) ;
|
|
305 |
|
|
306 |
aInfob = &aInfoPckg();
|
|
307 |
|
|
308 |
TESTL(aInfob->iMaxNumLength >0);
|
|
309 |
TESTL(aInfob->iMaxTextLength >=0);
|
|
310 |
TESTL(!aInfob->iName.Compare(KETelCombinedAdnPhoneBook()));
|
|
311 |
TESTL(aInfob->iCaps & RMobilePhoneStore::KCapsWriteAccess);
|
|
312 |
|
|
313 |
#ifdef __TEST_CANCEL__
|
|
314 |
combPhBk.GetInfo(aStatus, aInfoPckg);
|
|
315 |
combPhBk.CancelAsyncRequest(EMobilePhoneStoreGetInfo);
|
|
316 |
User::WaitForRequest(aStatus);
|
|
317 |
INFO_PRINTF2(_L("Async MT PhoneBook GetInfo Cancel Status = %d"),aStatus.Int());
|
|
318 |
TESTL(aStatus==KErrCancel || aStatus==KErrNone);
|
|
319 |
TEST_CHECKL((aStatus==KErrCancel || aStatus==KErrNone), ETrue, _L("GT83-TPHBK-003.13"));
|
|
320 |
#endif
|
|
321 |
|
|
322 |
combPhBk.Close();
|
|
323 |
}
|
|
324 |
}
|
|
325 |
return TestStepResult();
|
|
326 |
}
|
|
327 |
//------------------------------------------------------------------
|
|
328 |
|
|
329 |
CTestReadAndWrite::CTestReadAndWrite()
|
|
330 |
/** Each test step initialises it's own name
|
|
331 |
*/
|
|
332 |
{
|
|
333 |
// store the name of this test case
|
|
334 |
// this is the name that is used by the script file
|
|
335 |
SetTestStepName(_L("testReadAndWrite"));
|
|
336 |
}
|
|
337 |
//------------------------------------------------------------------
|
|
338 |
void CTestReadAndWrite::WriteToMEPhBkL()
|
|
339 |
/**
|
|
340 |
* This function is called from the testReadAndWrite() function. Writes to the 1st 4
|
|
341 |
* locations in the ME PhoneBook. Any existing entries in these locations will be overwritten.
|
|
342 |
* @test GT83-TPHBK-001.04 Test opening a ME-based phonebook of abbreviated dialling numbers.
|
|
343 |
* @test GT83-TPHBK-007.04 "Test writing a single phonebook entry to a specified location in a ME-based phonebook of abbreviated dialling numbers, where the location is empty"
|
|
344 |
*/
|
|
345 |
{
|
|
346 |
|
|
347 |
const TInt KEntries=4;
|
|
348 |
|
|
349 |
RMobilePhoneBookStore mePhBk;
|
|
350 |
TRequestStatus aStatus;
|
|
351 |
CHECKPOINT(mePhBk.Open(iPhone,KETelMeAdnPhoneBook), KErrNone, _L("GT83-TPHBK-001.04"));
|
|
352 |
|
|
353 |
INFO_PRINTF1(_L("Write to the ME PhoneBook..."));
|
|
354 |
|
|
355 |
TBuf8<KPBDataClientBuf> pbData; // Client reserved space for phonebook data
|
|
356 |
|
|
357 |
_LIT8(KTel,"123456%03d");
|
|
358 |
_LIT8(KText,"TelNo %03d");
|
|
359 |
TBuf8<13> text(KTel), number(KText);
|
|
360 |
TBuf<13> showText;
|
|
361 |
|
|
362 |
CPhoneBookBuffer* pbBuffer = new(ELeave) CPhoneBookBuffer(); // used to write phonebook data
|
|
363 |
pbBuffer->Set(&pbData); // Set it to point to the Client buffer
|
|
364 |
|
|
365 |
TInt index(0);
|
|
366 |
TInt idx(1);
|
|
367 |
|
|
368 |
while (index <= KEntries)
|
|
369 |
{
|
|
370 |
// First specify starting index and set iNumofEntries to 1, since it is only
|
|
371 |
// possible to write one entry at a time
|
|
372 |
|
|
373 |
//index = idx; // set index
|
|
374 |
|
|
375 |
number.FillZ(); // Reset previous values
|
|
376 |
number.Zero();
|
|
377 |
text.FillZ();
|
|
378 |
text.Zero();
|
|
379 |
pbData.FillZ();
|
|
380 |
pbData.Zero();
|
|
381 |
|
|
382 |
// convert number into TLV format and append it to allocated buffer
|
|
383 |
number.Format(KTel(), index);
|
|
384 |
TInt ret=pbBuffer->PutTagAndValue((TUint8)RMobilePhoneBookStore::ETagPBNumber, number);
|
|
385 |
TESTL(ret == KErrNone) ;
|
|
386 |
|
|
387 |
// convert number type into TLV format and append it to allocated buffer
|
|
388 |
ret=pbBuffer->PutTagAndValue((TUint8)RMobilePhoneBookStore::ETagPBTonNpi, (TUint8)RMobilePhone::EUnknownNumber);
|
|
389 |
|
|
390 |
text.Format(KText(), index);
|
|
391 |
showText.Copy(text) ;
|
|
392 |
INFO_PRINTF2(_L("Writing %S"), &showText);
|
|
393 |
|
|
394 |
// convert text into TLV format and append it to allocated buffer
|
|
395 |
ret=pbBuffer->PutTagAndValue((TUint8)RMobilePhoneBookStore::ETagPBText, text);
|
|
396 |
|
|
397 |
mePhBk.Write(aStatus, pbData, idx);
|
|
398 |
CHECKPOINT(aStatus.Int(), KErrNone, _L("GT83-TPHBK-007.04"));
|
|
399 |
User::WaitForRequest(aStatus);
|
|
400 |
index++;
|
|
401 |
}
|
|
402 |
|
|
403 |
mePhBk.Close();
|
|
404 |
|
|
405 |
delete pbBuffer;
|
|
406 |
}
|
|
407 |
//------------------------------------------------------------------
|
|
408 |
|
|
409 |
TVerdict CTestReadAndWrite::doTestStepL( void )
|
|
410 |
/**
|
|
411 |
* This function creates an array of names and telephone numbers which are to be used as
|
|
412 |
* phone book entries. It then writes these entries synchronously to the SIM phone book
|
|
413 |
* and reads them back. If the Combined Phone book is supported, entries are first written
|
|
414 |
* to the ME phonebook and then read from the Combined Phone book. This is because the MT
|
|
415 |
* (SIM + ME) phonebook does not have write access.
|
|
416 |
* @test GT83-TPHBK-001.06 Test opening an ICC-based phonebook of abbreviated dialling numbers
|
|
417 |
* @test GT83-TPHBK-002.06 Test closing an ICC-based phonebook of abbreviated dialling numbers
|
|
418 |
* @test GT83-TPHBK-002.11 Test closing a combination of the ADN stored in ME and ICC
|
|
419 |
* @test GT83-TPHBK-001.11 Test opening a combination of the ADN stored in ME and ICC
|
|
420 |
* @test GT83-TPHBK-006.06 Test retrieval of the first entry in an ICC-based phonebook of abbreviated dialling numbers
|
|
421 |
* @test GT83-TPHBK-006.11 Test retrieval of the first entry in a combination of the ADN stored in ME and ICC
|
|
422 |
* @test GT83-TPHBK-007.06 "Test writing a single phonebook entry to a specified location in an ICC-based phonebook containing voice mailbox numbers, where the location is empty"
|
|
423 |
* @test GT83-TPHBK-007.11 "Test writing a single phonebook entry to a specified location in an ICC-based phonebook containing the fixed dialling numbers list, when the phone is in a mode that allows editing the fixed dialling numbers, where the location is empty"
|
|
424 |
*/
|
|
425 |
{
|
|
426 |
TInt ret=KErrNone;
|
|
427 |
TRequestStatus aStatus;
|
|
428 |
RMobilePhoneBookStore* simPhBk = new(ELeave) RMobilePhoneBookStore();
|
|
429 |
CleanupStack::PushL(simPhBk);
|
|
430 |
|
|
431 |
// Create array of names and numbers
|
|
432 |
const TText16* names[]={(TText16*)KAnnText.iBuf, (TText16*)KMattSText.iBuf, (TText16*)KAndyText.iBuf,
|
|
433 |
(TText16*)KMattMText.iBuf,(TText16*)KPaulText.iBuf, (TText16*)KMumAndDadText.iBuf,
|
|
434 |
(TText16*)KSymbolText.iBuf,(TText16*)KTextTooLong.iBuf};
|
|
435 |
|
|
436 |
const TText16* numbers[]={(TText16*)KAnnPhoneNum.iBuf, (TText16*)KMattSPhoneNum.iBuf, (TText16*)KAndyPhoneNum.iBuf,
|
|
437 |
(TText16*)KMattMPhoneNum.iBuf, (TText16*)KPaulPhoneNum.iBuf, (TText16*)KMumAndDadPhoneNum.iBuf,
|
|
438 |
(TText16*)KSymbolPhoneNum.iBuf,(TText16*)KNumberTooLong.iBuf};
|
|
439 |
|
|
440 |
TBuf<KBufSize> entryNumber(numbers[0]);
|
|
441 |
TBuf<KBufSize> entryName(names[0]);
|
|
442 |
|
|
443 |
CPhoneBookBuffer* pbBuffer = new(ELeave) CPhoneBookBuffer();
|
|
444 |
CleanupStack::PushL(pbBuffer);
|
|
445 |
|
|
446 |
// Write the entries to the SIM Phone Book
|
|
447 |
TBuf8<KPBDataClientBuf>* pbData = new(ELeave) TBuf8<KPBDataClientBuf>; // Client reserved space for phonebook data
|
|
448 |
CleanupStack::PushL(pbData);
|
|
449 |
|
|
450 |
TBuf8<KPBDataClientBuf>* pbReadData1 = new(ELeave) TBuf8<KPBDataClientBuf>; // Client reserved space for phonebook data
|
|
451 |
CleanupStack::PushL(pbReadData1);
|
|
452 |
|
|
453 |
TBuf8<KPBDataClientBuf>* pbReadData2 = new(ELeave) TBuf8<KPBDataClientBuf>; // Client reserved space for phonebook data
|
|
454 |
CleanupStack::PushL(pbReadData2);
|
|
455 |
|
|
456 |
TBuf8<KPBDataClientBuf>* pbReadEmpty = new(ELeave) TBuf8<KPBDataClientBuf>; // Client reserved space for phonebook data
|
|
457 |
CleanupStack::PushL(pbReadEmpty);
|
|
458 |
|
|
459 |
TInt requestedIndex(0), numOfEntries(1);
|
|
460 |
|
|
461 |
// Read the entries back
|
|
462 |
TPtrC number(NULL,0);
|
|
463 |
TPtrC text(NULL,0);
|
|
464 |
|
|
465 |
TUint8 aTagValue(0);
|
|
466 |
CPhoneBookBuffer::TPhBkTagType aDataType;
|
|
467 |
TPtrC field(NULL,0);
|
|
468 |
TUint i(0) ;
|
|
469 |
TInt counter(0);
|
|
470 |
TUint type;
|
|
471 |
|
|
472 |
ret=simPhBk->Open(iPhone, KETelIccAdnPhoneBook());
|
|
473 |
|
|
474 |
if( ret != KErrNone)
|
|
475 |
{
|
|
476 |
INFO_PRINTF1(_L("Does SIM.TSY support KETelIccAdnPhoneBook?")) ;
|
|
477 |
simPhBk->Close();
|
|
478 |
}
|
|
479 |
else
|
|
480 |
{
|
|
481 |
TUint size(KPPBEntriesNum);
|
|
482 |
TInt writeIndex(0);
|
|
483 |
TUint index;
|
|
484 |
|
|
485 |
CHECKPOINT(ret, KErrNone, _L("GT83-TPHBK-001.06")) ;
|
|
486 |
|
|
487 |
pbBuffer->Set(pbData); // Set it to point to the Client buffer
|
|
488 |
|
|
489 |
for (i=1; i<=size; ++i)
|
|
490 |
{
|
|
491 |
//first reset the following three local buffers to delete any existing data
|
|
492 |
entryNumber.FillZ();
|
|
493 |
entryNumber.Zero();
|
|
494 |
entryName.FillZ();
|
|
495 |
entryName.Zero();
|
|
496 |
pbData->FillZ();
|
|
497 |
pbData->Zero();
|
|
498 |
|
|
499 |
entryNumber=numbers[i-1];
|
|
500 |
entryName=names[i-1];
|
|
501 |
|
|
502 |
// First specify starting index and set iNumofEntries to 1, since it is only
|
|
503 |
// possible to write one entry at a time
|
|
504 |
|
|
505 |
writeIndex = i; // Note that TSY will overwrite any existing data. It is up to
|
|
506 |
// the Sync to check whether it is the first available entry
|
|
507 |
|
|
508 |
// convert number into TLV format and append it to allocated buffer
|
|
509 |
ret=pbBuffer->PutTagAndValue((TUint8)RMobilePhoneBookStore::ETagPBNumber, entryNumber);
|
|
510 |
TESTL(ret == KErrNone) ;
|
|
511 |
|
|
512 |
// convert type into TLV format and append it to allocated buffer
|
|
513 |
ret=pbBuffer->PutTagAndValue((TUint8)RMobilePhoneBookStore::ETagPBTonNpi, (TUint8)RMobilePhone::EUnknownNumber); // AMC - "Unknown" numbers are written, so unknown numbers will be read in the tests below.
|
|
514 |
TESTL(ret == KErrNone) ;
|
|
515 |
|
|
516 |
// convert text into TLV format and append it to allocated buffer
|
|
517 |
ret=pbBuffer->PutTagAndValue((TUint8)RMobilePhoneBookStore::ETagPBText, entryName);
|
|
518 |
TESTL(ret == KErrNone) ;
|
|
519 |
|
|
520 |
simPhBk->Write(aStatus, *pbData, writeIndex);
|
|
521 |
User::WaitForRequest(aStatus);
|
|
522 |
CHECKPOINT(aStatus.Int(), KErrNone, _L("GT83-TPHBK-007.06")); //???????
|
|
523 |
}
|
|
524 |
|
|
525 |
|
|
526 |
// Reads Forwads and it reads all entries individually
|
|
527 |
for(i=1; i<=size; ++i)
|
|
528 |
{
|
|
529 |
//first reset the following three local buffers to delete any existing data
|
|
530 |
entryNumber.FillZ();
|
|
531 |
entryNumber.Zero();
|
|
532 |
entryName.FillZ();
|
|
533 |
entryName.Zero();
|
|
534 |
pbData->FillZ();
|
|
535 |
pbData->Zero();
|
|
536 |
|
|
537 |
// reset all loop variables
|
|
538 |
index = 0;
|
|
539 |
type = 0;
|
|
540 |
counter = 0;
|
|
541 |
aTagValue = 0;
|
|
542 |
|
|
543 |
requestedIndex = i;
|
|
544 |
simPhBk->Read(aStatus, requestedIndex, numOfEntries, *pbReadData1);
|
|
545 |
User::WaitForRequest(aStatus);
|
|
546 |
CHECKPOINT(aStatus.Int(), KErrNone, _L("GT83-TPHBK-006.06")) ;
|
|
547 |
|
|
548 |
entryNumber=numbers[i-1];
|
|
549 |
entryName=names[i-1];
|
|
550 |
|
|
551 |
// now decode PB data received in TLV format
|
|
552 |
pbBuffer->Set(pbReadData1); // Set pbBuffer to point to received phonebook data
|
|
553 |
pbBuffer->StartRead(); // Start reading received phonebook data
|
|
554 |
while(counter < pbReadData1->Length())
|
|
555 |
{
|
|
556 |
TInt ret = pbBuffer->GetTagAndType(aTagValue, aDataType);
|
|
557 |
if(ret==KErrNotFound) // Reached the end of phonebook data
|
|
558 |
break;
|
|
559 |
TESTL(ret == KErrNone) ;
|
|
560 |
switch(aDataType)
|
|
561 |
{
|
|
562 |
case CPhoneBookBuffer::EPhBkTypeInt8:
|
|
563 |
{
|
|
564 |
TUint8 int8(0);
|
|
565 |
pbBuffer->GetValue(int8);
|
|
566 |
counter = counter + 2; // add tag-field only in case that is beginning of new field
|
|
567 |
if(aTagValue == RMobilePhoneBookStore::ETagPBTonNpi)
|
|
568 |
{
|
|
569 |
type = int8;
|
|
570 |
}
|
|
571 |
}
|
|
572 |
break;
|
|
573 |
|
|
574 |
case CPhoneBookBuffer::EPhBkTypeInt16:
|
|
575 |
{
|
|
576 |
TUint16 int16(0);
|
|
577 |
pbBuffer->GetValue(int16);
|
|
578 |
counter = counter + 3; // 2-byte integer + tag-field
|
|
579 |
if(aTagValue == RMobilePhoneBookStore::ETagPBAdnIndex)
|
|
580 |
{
|
|
581 |
index = int16;
|
|
582 |
}
|
|
583 |
}
|
|
584 |
break;
|
|
585 |
|
|
586 |
case CPhoneBookBuffer::EPhBkTypeInt32:
|
|
587 |
{
|
|
588 |
TUint32 int32(0);
|
|
589 |
pbBuffer->GetValue(int32);
|
|
590 |
counter = counter + 5; // 4-byte integer + tag-field
|
|
591 |
}
|
|
592 |
break;
|
|
593 |
|
|
594 |
case CPhoneBookBuffer::EPhBkTypeDes16:
|
|
595 |
{
|
|
596 |
pbBuffer->GetValue(field);
|
|
597 |
counter = counter + field.Length() + 3; // add desc length + length-field + tag-field
|
|
598 |
if(aTagValue == RMobilePhoneBookStore::ETagPBText)
|
|
599 |
{
|
|
600 |
text.Set(field);
|
|
601 |
}
|
|
602 |
else if(aTagValue == RMobilePhoneBookStore::ETagPBNumber)
|
|
603 |
{
|
|
604 |
number.Set(field);
|
|
605 |
}
|
|
606 |
}
|
|
607 |
break;
|
|
608 |
|
|
609 |
default:
|
|
610 |
break;
|
|
611 |
} // end switch aDataType
|
|
612 |
|
|
613 |
} // end while
|
|
614 |
|
|
615 |
|
|
616 |
TESTL(TInt(type)==RMobilePhone::EUnknownNumber);
|
|
617 |
TESTL(number.Compare(entryNumber)==KErrNone);
|
|
618 |
TESTL(text.Compare(entryName)==KErrNone);
|
|
619 |
TESTL(index == i) ;
|
|
620 |
} // end for
|
|
621 |
|
|
622 |
|
|
623 |
// Try to read an empty entry
|
|
624 |
requestedIndex = i+1; // Now set index to point to last entry in phonebook
|
|
625 |
simPhBk->Read(aStatus, requestedIndex, numOfEntries, *pbReadEmpty);
|
|
626 |
User::WaitForRequest(aStatus);
|
|
627 |
CHECKPOINT(aStatus.Int(), KErrNotFound, _L("GT83-TPHBK-006.06")) ; // If asked to read an empty entry, TSY will not return an error
|
|
628 |
// It is now clients responsibility to ensure a valid index is supplied
|
|
629 |
// Read Backwards, one by one
|
|
630 |
for(i=size; i>0; --i)
|
|
631 |
{
|
|
632 |
//first reset the following three local buffers to delete any existing data
|
|
633 |
entryNumber.FillZ();
|
|
634 |
entryNumber.Zero();
|
|
635 |
entryName.FillZ();
|
|
636 |
entryName.Zero();
|
|
637 |
pbData->FillZ();
|
|
638 |
pbData->Zero();
|
|
639 |
|
|
640 |
requestedIndex = i;
|
|
641 |
simPhBk->Read(aStatus, requestedIndex, numOfEntries, *pbReadData2);
|
|
642 |
User::WaitForRequest(aStatus);
|
|
643 |
CHECKPOINT(aStatus.Int(), KErrNone, _L("GT83-TPHBK-006.06")) ;
|
|
644 |
|
|
645 |
entryNumber=numbers[i-1];
|
|
646 |
entryName=names[i-1];
|
|
647 |
|
|
648 |
// reset all loop variables
|
|
649 |
index = 0;
|
|
650 |
type = 0;
|
|
651 |
counter = 0;
|
|
652 |
aTagValue = 0;
|
|
653 |
|
|
654 |
// now decode PB data received in TLV format
|
|
655 |
pbBuffer->Set(pbReadData2); // Set pbBuffer to point to received phonebook data
|
|
656 |
pbBuffer->StartRead(); // Start reading received phonebook data
|
|
657 |
while(counter < pbReadData2->Length())
|
|
658 |
{
|
|
659 |
TInt ret = pbBuffer->GetTagAndType(aTagValue, aDataType);
|
|
660 |
if(ret==KErrNotFound) // Reached the end of phonebook data
|
|
661 |
break;
|
|
662 |
TESTL(ret == KErrNone) ;
|
|
663 |
switch(aDataType)
|
|
664 |
{
|
|
665 |
case CPhoneBookBuffer::EPhBkTypeInt8:
|
|
666 |
{
|
|
667 |
TUint8 int8(0);
|
|
668 |
counter = counter + 2; // add tag-field only in case that is beginning of new field
|
|
669 |
pbBuffer->GetValue(int8); //
|
|
670 |
if(aTagValue == RMobilePhoneBookStore::ETagPBTonNpi)
|
|
671 |
{
|
|
672 |
type = int8;
|
|
673 |
}
|
|
674 |
}
|
|
675 |
break;
|
|
676 |
|
|
677 |
case CPhoneBookBuffer::EPhBkTypeInt16:
|
|
678 |
{
|
|
679 |
TUint16 int16(0);
|
|
680 |
pbBuffer->GetValue(int16);
|
|
681 |
counter = counter + 3; // 2-byte integer + tag-field
|
|
682 |
if(aTagValue == RMobilePhoneBookStore::ETagPBAdnIndex)
|
|
683 |
{
|
|
684 |
index = int16;
|
|
685 |
}
|
|
686 |
}
|
|
687 |
break;
|
|
688 |
|
|
689 |
case CPhoneBookBuffer::EPhBkTypeInt32:
|
|
690 |
{
|
|
691 |
TUint32 int32(0);
|
|
692 |
pbBuffer->GetValue(int32);
|
|
693 |
counter = counter + 5; // 4-byte integer + tag-field
|
|
694 |
}
|
|
695 |
break;
|
|
696 |
|
|
697 |
case CPhoneBookBuffer::EPhBkTypeDes16:
|
|
698 |
{
|
|
699 |
pbBuffer->GetValue(field);
|
|
700 |
counter = counter + field.Length() + 3; // add desc length + length-field + tag-field
|
|
701 |
if(aTagValue == RMobilePhoneBookStore::ETagPBText)
|
|
702 |
{
|
|
703 |
text.Set(field);
|
|
704 |
}
|
|
705 |
else if(aTagValue == RMobilePhoneBookStore::ETagPBNumber)
|
|
706 |
{
|
|
707 |
number.Set(field);
|
|
708 |
}
|
|
709 |
}
|
|
710 |
break;
|
|
711 |
|
|
712 |
default:
|
|
713 |
break;
|
|
714 |
} // end switch aDataType
|
|
715 |
|
|
716 |
} // end while
|
|
717 |
|
|
718 |
|
|
719 |
TESTL(TInt(type)==RMobilePhone::EUnknownNumber); // AMC - modified to match the Phonebook number "type" written at the start of this test program.
|
|
720 |
TESTL(number.Compare(entryNumber)==KErrNone);
|
|
721 |
TESTL(text.Compare(entryName)==KErrNone);
|
|
722 |
TESTL(index == i) ;
|
|
723 |
} // end for
|
|
724 |
|
|
725 |
// Try to read below the phonebook limits
|
|
726 |
requestedIndex = i-1;
|
|
727 |
simPhBk->Read(aStatus, requestedIndex, numOfEntries, *pbReadEmpty);
|
|
728 |
User::WaitForRequest(aStatus);
|
|
729 |
INFO_PRINTF2(_L("DEBUG_LOG: aStatus == %d"), aStatus.Int());
|
|
730 |
//CHECKPOINT(aStatus.Int(), KErrNone, _L("GT83-TPHBK-006.06")) ; // If asked to read an empty entry, TSY will not return an error
|
|
731 |
TEST((aStatus.Int()==KErrNone) || (aStatus.Int()==KErrArgument));
|
|
732 |
// It is now clients responsibility to ensure a valid index is supplied
|
|
733 |
|
|
734 |
// Read by index, uses the Read() method
|
|
735 |
for(i=1; i<=size; ++i)
|
|
736 |
{
|
|
737 |
//first reset the following three local buffers to delete any existing data
|
|
738 |
entryNumber.FillZ();
|
|
739 |
entryNumber.Zero();
|
|
740 |
entryName.FillZ();
|
|
741 |
entryName.Zero();
|
|
742 |
pbData->FillZ();
|
|
743 |
pbData->Zero();
|
|
744 |
|
|
745 |
requestedIndex = i;
|
|
746 |
simPhBk->Read(aStatus, requestedIndex, numOfEntries, *pbReadData1);
|
|
747 |
User::WaitForRequest(aStatus);
|
|
748 |
CHECKPOINT(aStatus.Int(), KErrNone, _L("GT83-TPHBK-006.06")) ;
|
|
749 |
|
|
750 |
entryNumber=numbers[i-1];
|
|
751 |
entryName=names[i-1];
|
|
752 |
|
|
753 |
// reset all loop variables
|
|
754 |
index = 0;
|
|
755 |
type = 0;
|
|
756 |
counter = 0;
|
|
757 |
aTagValue = 0;
|
|
758 |
|
|
759 |
// now decode PB data received in TLV format
|
|
760 |
pbBuffer->Set(pbReadData1); // Set pbBuffer to point to received phonebook data
|
|
761 |
pbBuffer->StartRead(); // Start reading received phonebook data
|
|
762 |
while(counter < pbReadData1->Length())
|
|
763 |
{
|
|
764 |
TInt ret = pbBuffer->GetTagAndType(aTagValue, aDataType);
|
|
765 |
if(ret==KErrNotFound) // Reached the end of phonebook data
|
|
766 |
break;
|
|
767 |
TESTL(ret == KErrNone) ;
|
|
768 |
switch(aDataType)
|
|
769 |
{
|
|
770 |
case CPhoneBookBuffer::EPhBkTypeInt8:
|
|
771 |
{
|
|
772 |
TUint8 int8(0);
|
|
773 |
counter = counter + 2; // add tag-field only in case that is beginning of new field
|
|
774 |
pbBuffer->GetValue(int8); //
|
|
775 |
if(aTagValue == RMobilePhoneBookStore::ETagPBTonNpi)
|
|
776 |
{
|
|
777 |
type = int8;
|
|
778 |
}
|
|
779 |
}
|
|
780 |
break;
|
|
781 |
|
|
782 |
case CPhoneBookBuffer::EPhBkTypeInt16:
|
|
783 |
{
|
|
784 |
TUint16 int16(0);
|
|
785 |
pbBuffer->GetValue(int16);
|
|
786 |
counter = counter + 3; // 2-byte integer + tag-field
|
|
787 |
if(aTagValue == RMobilePhoneBookStore::ETagPBAdnIndex)
|
|
788 |
{
|
|
789 |
index = int16;
|
|
790 |
}
|
|
791 |
}
|
|
792 |
break;
|
|
793 |
|
|
794 |
case CPhoneBookBuffer::EPhBkTypeInt32:
|
|
795 |
{
|
|
796 |
TUint32 int32(0);
|
|
797 |
pbBuffer->GetValue(int32);
|
|
798 |
counter = counter + 5; // 4-byte integer + tag-field
|
|
799 |
}
|
|
800 |
break;
|
|
801 |
|
|
802 |
case CPhoneBookBuffer::EPhBkTypeDes16:
|
|
803 |
{
|
|
804 |
pbBuffer->GetValue(field);
|
|
805 |
counter = counter + field.Length() + 3; // add desc length + length-field + tag-field
|
|
806 |
if(aTagValue == RMobilePhoneBookStore::ETagPBText)
|
|
807 |
{
|
|
808 |
text.Set(field);
|
|
809 |
}
|
|
810 |
else if(aTagValue == RMobilePhoneBookStore::ETagPBNumber)
|
|
811 |
{
|
|
812 |
number.Set(field);
|
|
813 |
}
|
|
814 |
}
|
|
815 |
break;
|
|
816 |
|
|
817 |
default:
|
|
818 |
break;
|
|
819 |
} // end switch aDataType
|
|
820 |
|
|
821 |
} // end while
|
|
822 |
|
|
823 |
|
|
824 |
TESTL(TInt(type)==RMobilePhone::EUnknownNumber); // AMC - modified to match the Phonebook number "type" written at the start of this test program.
|
|
825 |
TESTL(number.Compare(entryNumber)==KErrNone);
|
|
826 |
TESTL(text.Compare(entryName)==KErrNone);
|
|
827 |
TESTL(index == i) ;
|
|
828 |
}
|
|
829 |
|
|
830 |
simPhBk->Close();
|
|
831 |
}
|
|
832 |
// From Combined phone book
|
|
833 |
|
|
834 |
if (iMTSupported)
|
|
835 |
{
|
|
836 |
//
|
|
837 |
// This part of the test reads the 1st few entries in the combined Phone Book (ME+
|
|
838 |
// SIM). As the Combined Phonebook does not (should not) have 'WriteAccess', some
|
|
839 |
// entries will first be written to the ME phone book. The SIM phone book
|
|
840 |
// already contains the entries written above.
|
|
841 |
//
|
|
842 |
WriteToMEPhBkL(); //writing 5 entries to ME ph/book
|
|
843 |
|
|
844 |
RMobilePhoneBookStore* combPhBk = new(ELeave) RMobilePhoneBookStore();
|
|
845 |
CleanupStack::PushL(combPhBk);
|
|
846 |
|
|
847 |
ret=combPhBk->Open(iPhone, KETelCombinedAdnPhoneBook);
|
|
848 |
CHECKPOINT(ret, KErrNone, _L("GT83-TPHBK-001.11")) ;
|
|
849 |
|
|
850 |
const TUint KEntries=4; // Same value in WriteToMEPhBk()
|
|
851 |
const TInt KBufSize=20;
|
|
852 |
|
|
853 |
_LIT(KTel,"123456%03d");
|
|
854 |
_LIT(KText,"TelNo %03d");
|
|
855 |
TBuf<KBufSize> TelNum;
|
|
856 |
TBuf<KBufSize> Text;
|
|
857 |
|
|
858 |
// Read index locations 1 to KEntries
|
|
859 |
TUint index=1;
|
|
860 |
i = KEntries ;
|
|
861 |
while (index<=KEntries)
|
|
862 |
{
|
|
863 |
requestedIndex = i;
|
|
864 |
TelNum.Format(KTel,index);
|
|
865 |
Text.Format(KText,index);
|
|
866 |
|
|
867 |
combPhBk->Read(aStatus, requestedIndex, numOfEntries, *pbReadData2);
|
|
868 |
User::WaitForRequest(aStatus);
|
|
869 |
CHECKPOINT(aStatus.Int(), KErrNone, _L("GT83-TPHBK-006.11")) ;
|
|
870 |
entryNumber=numbers[i-1];
|
|
871 |
entryName=names[i-1];
|
|
872 |
|
|
873 |
// reset all loop variables
|
|
874 |
index = 0;
|
|
875 |
type = 0;
|
|
876 |
counter = 0;
|
|
877 |
aTagValue = 0;
|
|
878 |
|
|
879 |
// now decode PB data received in TLV format
|
|
880 |
pbBuffer->Set(pbReadData2); // Set pbBuffer to point to received phonebook data
|
|
881 |
pbBuffer->StartRead(); // Start reading received phonebook data
|
|
882 |
while(counter < pbReadData2->Length())
|
|
883 |
{
|
|
884 |
TInt ret = pbBuffer->GetTagAndType(aTagValue, aDataType);
|
|
885 |
if(ret==KErrNotFound) // Reached the end of phonebook data
|
|
886 |
break;
|
|
887 |
TESTL(ret == KErrNone) ;
|
|
888 |
switch(aDataType)
|
|
889 |
{
|
|
890 |
case CPhoneBookBuffer::EPhBkTypeInt8:
|
|
891 |
{
|
|
892 |
TUint8 int8(0);
|
|
893 |
counter = counter + 1; // add tag-field only in case that is beginning of new field
|
|
894 |
if(aTagValue == RMobilePhoneBookStore::ETagPBAdnIndex)
|
|
895 |
{
|
|
896 |
pbBuffer->GetValue(int8); //
|
|
897 |
counter = counter + 1; // 1-byte integer
|
|
898 |
index = int8;
|
|
899 |
}
|
|
900 |
}
|
|
901 |
break;
|
|
902 |
|
|
903 |
case CPhoneBookBuffer::EPhBkTypeInt16:
|
|
904 |
{
|
|
905 |
TUint16 int16(0);
|
|
906 |
pbBuffer->GetValue(int16);
|
|
907 |
counter = counter + 3; // 2-byte integer + tag-field
|
|
908 |
if(aTagValue == RMobilePhoneBookStore::ETagPBTonNpi)
|
|
909 |
{
|
|
910 |
type = int16;
|
|
911 |
}
|
|
912 |
}
|
|
913 |
break;
|
|
914 |
|
|
915 |
case CPhoneBookBuffer::EPhBkTypeInt32:
|
|
916 |
{
|
|
917 |
TUint32 int32(0);
|
|
918 |
pbBuffer->GetValue(int32);
|
|
919 |
counter = counter + 5; // 4-byte integer + tag-field
|
|
920 |
}
|
|
921 |
break;
|
|
922 |
|
|
923 |
case CPhoneBookBuffer::EPhBkTypeDes16:
|
|
924 |
{
|
|
925 |
pbBuffer->GetValue(field);
|
|
926 |
counter = counter + field.Length() + 3; // add desc length + length-field + tag-field
|
|
927 |
if(aTagValue == RMobilePhoneBookStore::ETagPBText)
|
|
928 |
{
|
|
929 |
text.Set(field);
|
|
930 |
}
|
|
931 |
else if(aTagValue == RMobilePhoneBookStore::ETagPBNumber)
|
|
932 |
{
|
|
933 |
number.Set(field);
|
|
934 |
}
|
|
935 |
}
|
|
936 |
break;
|
|
937 |
|
|
938 |
default:
|
|
939 |
break;
|
|
940 |
} // end switch aDataType
|
|
941 |
} // end while
|
|
942 |
|
|
943 |
|
|
944 |
TESTL(TInt(type)==RMobilePhone::EUnknownNumber); // AMC - modified to match the Phonebook number "type" written at the start of this test program.
|
|
945 |
TESTL(number.Compare(TelNum)==KErrNone);
|
|
946 |
TESTL(text.Compare(Text)==KErrNone);
|
|
947 |
TESTL(index == i) ;
|
|
948 |
index++;
|
|
949 |
} // end while
|
|
950 |
|
|
951 |
// Entry to write - this should be read only...
|
|
952 |
requestedIndex = 5;
|
|
953 |
|
|
954 |
// convert number into TLV format and append it to allocated buffer
|
|
955 |
ret=pbBuffer->PutTagAndValue((TUint8)RMobilePhoneBookStore::ETagPBNumber, KAnnPhoneNum);
|
|
956 |
TESTL(ret == KErrNone) ;
|
|
957 |
|
|
958 |
// convert number type into TLV format and append it to allocated buffer
|
|
959 |
ret=pbBuffer->PutTagAndValue((TUint8)RMobilePhoneBookStore::ETagPBTonNpi, (TUint8)RMobilePhone::EUnknownNumber);
|
|
960 |
TESTL(ret == KErrNone) ;
|
|
961 |
|
|
962 |
// convert text into TLV format and append it to allocated buffer
|
|
963 |
ret=pbBuffer->PutTagAndValue((TUint8)RMobilePhoneBookStore::ETagPBText, KAnnText);
|
|
964 |
TESTL(ret == KErrNone) ;
|
|
965 |
|
|
966 |
combPhBk->Write(aStatus, *pbData, requestedIndex);
|
|
967 |
User::WaitForRequest(aStatus);
|
|
968 |
if (aStatus!=KErrNotSupported)
|
|
969 |
{
|
|
970 |
INFO_PRINTF1(_L("A write has completed successfully to the MT PhoneBook."));
|
|
971 |
INFO_PRINTF1(_L("** The MT PhoneBook should NOT have WriteAccess!! ** "));
|
|
972 |
}
|
|
973 |
else
|
|
974 |
{
|
|
975 |
CHECKPOINT(aStatus.Int(), KErrNone, _L("GT83-TPHBK-007.11")) ;
|
|
976 |
}
|
|
977 |
|
|
978 |
combPhBk->Close();
|
|
979 |
CleanupStack::PopAndDestroy(combPhBk);
|
|
980 |
}
|
|
981 |
|
|
982 |
CleanupStack::PopAndDestroy(pbReadEmpty);
|
|
983 |
CleanupStack::PopAndDestroy(pbReadData2);
|
|
984 |
CleanupStack::PopAndDestroy(pbReadData1);
|
|
985 |
CleanupStack::PopAndDestroy(pbData);
|
|
986 |
CleanupStack::PopAndDestroy(pbBuffer);
|
|
987 |
CleanupStack::PopAndDestroy(simPhBk);
|
|
988 |
|
|
989 |
return TestStepResult();
|
|
990 |
}
|
|
991 |
//------------------------------------------------------------------
|
|
992 |
|
|
993 |
CTestDelete::CTestDelete()
|
|
994 |
/** Each test step initialises it's own name
|
|
995 |
*/
|
|
996 |
{
|
|
997 |
// store the name of this test case
|
|
998 |
// this is the name that is used by the script file
|
|
999 |
SetTestStepName(_L("testDelete"));
|
|
1000 |
}
|
|
1001 |
//------------------------------------------------------------------
|
|
1002 |
|
|
1003 |
TVerdict CTestDelete::doTestStepL( void )
|
|
1004 |
/**
|
|
1005 |
* This function deletes the first 7 entries from the SIM phone book
|
|
1006 |
* @test GT83-TPHBK-001.06 Test opening an ICC-based phonebook of abbreviated dialling numbers
|
|
1007 |
* @test GT83-TPHBK-002.06 Test closing an ICC-based phonebook of abbreviated dialling numbers
|
|
1008 |
* @test GT83-TPHBK-006.06 Test retrieval of the first entry in an ICC-based phonebook of abbreviated dialling numbers
|
|
1009 |
* @test GT83-TPHBK-008.06 Test deleting an individual phonebook entry from an ICC-based phonebook of abbreviated dialling numbers
|
|
1010 |
*/
|
|
1011 |
{
|
|
1012 |
TRequestStatus aStatus;
|
|
1013 |
RMobilePhoneBookStore simPhBk;
|
|
1014 |
TBuf8<KPBDataClientBuf> pbData; // Client reserved space for phonebook data
|
|
1015 |
TInt index(0), numOfEntries(0);
|
|
1016 |
|
|
1017 |
TInt ret = simPhBk.Open(iPhone, KETelIccAdnPhoneBook) ;
|
|
1018 |
if( ret ==KErrNone)
|
|
1019 |
{
|
|
1020 |
TInt i=0;
|
|
1021 |
TInt size=KPPBEntriesNum;
|
|
1022 |
|
|
1023 |
for(i=1; i<=size; ++i)
|
|
1024 |
{
|
|
1025 |
simPhBk.Delete(aStatus, i);
|
|
1026 |
User::WaitForRequest(aStatus);
|
|
1027 |
CHECKPOINT(aStatus.Int(), KErrNone, _L("GT83-TPHBK-008.06")) ;
|
|
1028 |
}
|
|
1029 |
|
|
1030 |
// now try to read first (empty) entry
|
|
1031 |
index = 1;
|
|
1032 |
simPhBk.Read(aStatus, index, numOfEntries, pbData);
|
|
1033 |
User::WaitForRequest(aStatus); //hs
|
|
1034 |
CHECKPOINT(aStatus.Int(), KErrNotFound, _L("GT83-TPHBK-006.06")) ;
|
|
1035 |
// If asked to read an emptry entry, TSY will return KErrNotFound error
|
|
1036 |
// It is now client's responsibility to ensure a valid index is supplied
|
|
1037 |
}
|
|
1038 |
else
|
|
1039 |
{
|
|
1040 |
INFO_PRINTF1(_L("Does SIM.TSY support KETelIccAdnPhoneBook?")) ;
|
|
1041 |
}
|
|
1042 |
|
|
1043 |
simPhBk.Close();
|
|
1044 |
return TestStepResult();
|
|
1045 |
}
|
|
1046 |
//------------------------------------------------------------------
|
|
1047 |
|
|
1048 |
CTestNotifications::CTestNotifications()
|
|
1049 |
/** Each test step initialises it's own name
|
|
1050 |
*/
|
|
1051 |
{
|
|
1052 |
// store the name of this test case
|
|
1053 |
// this is the name that is used by the script file
|
|
1054 |
SetTestStepName(_L("testNotifications"));
|
|
1055 |
}
|
|
1056 |
//------------------------------------------------------------------
|
|
1057 |
|
|
1058 |
TVerdict CTestNotifications::doTestStepL( void )
|
|
1059 |
/**
|
|
1060 |
* This function opens the SIM and MT (if supported) phonebooks and posts a request for
|
|
1061 |
* notification. Since this notification is not supported by any phonebook it should receive
|
|
1062 |
* KErrNotSupported.
|
|
1063 |
* @test GT83-TPHBK-001.06 Test opening an ICC-based phonebook of abbreviated dialling numbers
|
|
1064 |
* @test GT83-TPHBK-002.06 Test closing an ICC-based phonebook of abbreviated dialling numbers
|
|
1065 |
* @test GT83-TPHBK-007.06 "Test writing a single phonebook entry to a specified location in an ICC-based phonebook containing voice mailbox numbers, where the location is empty"
|
|
1066 |
* @test GT83-TPHBK-008.06 Test deleting an individual phonebook entry from an ICC-based phonebook of abbreviated dialling numbers
|
|
1067 |
* @test GT83-TPHBK-008.16 Test cancelling deleting individual phonebook entries from a phonebook
|
|
1068 |
* @test GT83-TPHBK-007.17 Test writing a single phonebook entry to a combination of the ADN stored in ME and ICC
|
|
1069 |
* @test GT83-TPHBK-008.13 Test deleting an individual phonebook entry from a combination of the ADN stored in ME and ICC
|
|
1070 |
*/
|
|
1071 |
{
|
|
1072 |
RMobilePhoneBookStore simPhBk, combPhBk;
|
|
1073 |
TBuf8<KPBDataClientBuf> pbData; // Client reserved space for phonebook data
|
|
1074 |
TInt index(0), ret(0);
|
|
1075 |
TRequestStatus aStatus, status1, status2;
|
|
1076 |
TInt index1 = 0;
|
|
1077 |
TInt index2 = 0;
|
|
1078 |
TUint32 eventToReturn;
|
|
1079 |
|
|
1080 |
CPhoneBookBuffer* pbBuffer=new(ELeave) CPhoneBookBuffer(); // used to read/write phonebook entries
|
|
1081 |
pbBuffer->Set(&pbData); // Set it to point to the Client buffer
|
|
1082 |
|
|
1083 |
ret = simPhBk.Open(iPhone, KETelIccAdnPhoneBook) ;
|
|
1084 |
|
|
1085 |
if(ret!=KErrNone)
|
|
1086 |
{
|
|
1087 |
INFO_PRINTF1(_L("Does SIM.TSY support KETelIccAdnPhoneBook?")) ;
|
|
1088 |
}
|
|
1089 |
else
|
|
1090 |
{
|
|
1091 |
|
|
1092 |
simPhBk.NotifyStoreEvent(status1, eventToReturn,index1); // Will Notify if an entry is added
|
|
1093 |
TESTL(status1.Int() == KRequestPending) ;
|
|
1094 |
|
|
1095 |
if (iMTSupported && combPhBk.Open(iPhone, KETelCombinedAdnPhoneBook)==KErrNone)
|
|
1096 |
{
|
|
1097 |
TESTL(combPhBk.Open(iPhone, KETelCombinedAdnPhoneBook)==KErrNone);
|
|
1098 |
combPhBk.NotifyStoreEvent(status2, eventToReturn, index2); // Same here ;-)
|
|
1099 |
}
|
|
1100 |
|
|
1101 |
index = 1; // write to the first slot
|
|
1102 |
// convert number into TLV format and append it to allocated buffer
|
|
1103 |
ret=pbBuffer->PutTagAndValue((TUint8)RMobilePhoneBookStore::ETagPBNumber, KAnnPhoneNum);
|
|
1104 |
TESTL(ret == KErrNone) ;
|
|
1105 |
|
|
1106 |
// convert number type into TLV format and append it to allocated buffer
|
|
1107 |
ret=pbBuffer->PutTagAndValue((TUint8)RMobilePhoneBookStore::ETagPBTonNpi, (TUint8)RMobilePhone::EUnknownNumber);
|
|
1108 |
TESTL(ret == KErrNone) ;
|
|
1109 |
|
|
1110 |
// convert text into TLV format and append it to allocated buffer
|
|
1111 |
ret=pbBuffer->PutTagAndValue((TUint8)RMobilePhoneBookStore::ETagPBText, KAnnText);
|
|
1112 |
TESTL(ret == KErrNone) ;
|
|
1113 |
|
|
1114 |
simPhBk.Write(aStatus, pbData, index);
|
|
1115 |
User::WaitForRequest(aStatus); // Write request
|
|
1116 |
CHECKPOINT(aStatus.Int(), KErrNone, _L("GT83-TPHBK-007.06")) ;
|
|
1117 |
User::WaitForRequest(status1); // Notification
|
|
1118 |
|
|
1119 |
if (status1==KErrNotSupported)
|
|
1120 |
{
|
|
1121 |
// Notification is not supported by phonebook store
|
|
1122 |
INFO_PRINTF1(_L("Phonebook Store Write Notification is NOT Supported"));
|
|
1123 |
}
|
|
1124 |
else
|
|
1125 |
{
|
|
1126 |
// This should happen since this notification is supported by phonebook store
|
|
1127 |
INFO_PRINTF1(_L("Phonebook Store Write Notification IS Supported - Succeeded"));
|
|
1128 |
}
|
|
1129 |
|
|
1130 |
if (iMTSupported)
|
|
1131 |
{
|
|
1132 |
|
|
1133 |
combPhBk.Write(aStatus, pbData, index);
|
|
1134 |
User::WaitForRequest(aStatus); // Write request
|
|
1135 |
CHECKPOINT(aStatus.Int(), KErrNone, _L("GT83-TPHBK-007.17")) ;
|
|
1136 |
|
|
1137 |
User::WaitForRequest(status2);
|
|
1138 |
|
|
1139 |
if (status2==KErrNotSupported)
|
|
1140 |
{
|
|
1141 |
// Notification is not supported by phonebook store
|
|
1142 |
INFO_PRINTF1(_L("Phonebook Store Write Notification is NOT Supported"));
|
|
1143 |
}
|
|
1144 |
else
|
|
1145 |
{
|
|
1146 |
// This should happen since this notification is not supported by phonebook store
|
|
1147 |
INFO_PRINTF1(_L("Phonebook Store Write Notification IS Supported - Succeeded"));
|
|
1148 |
}
|
|
1149 |
}
|
|
1150 |
|
|
1151 |
status1= KErrNone; // reset status variable
|
|
1152 |
simPhBk.NotifyStoreEvent(status1, eventToReturn, index1);
|
|
1153 |
|
|
1154 |
if (iMTSupported)
|
|
1155 |
{
|
|
1156 |
combPhBk.NotifyStoreEvent(status2, eventToReturn, index2);
|
|
1157 |
}
|
|
1158 |
|
|
1159 |
// Now delete that entry
|
|
1160 |
simPhBk.Delete(aStatus, 1);
|
|
1161 |
User::WaitForRequest(aStatus);
|
|
1162 |
CHECKPOINT(aStatus.Int(), KErrNone, _L("GT83-TPHBK-008.06")) ;
|
|
1163 |
|
|
1164 |
User::WaitForRequest(status1);
|
|
1165 |
if (status1==KErrNotSupported)
|
|
1166 |
{
|
|
1167 |
// Notification is not supported by phonebook store
|
|
1168 |
INFO_PRINTF1(_L("Phonebook Store Delete Notification is NOT Supported"));
|
|
1169 |
}
|
|
1170 |
else
|
|
1171 |
{
|
|
1172 |
// This should not happen since this notification is not supported by phonebook store
|
|
1173 |
INFO_PRINTF1(_L("Phonebook Store Delete Notification IS Supported - Succeeded"));
|
|
1174 |
}
|
|
1175 |
|
|
1176 |
if (iMTSupported)
|
|
1177 |
{
|
|
1178 |
// Now delete that entry
|
|
1179 |
combPhBk.Delete(aStatus, 1);
|
|
1180 |
User::WaitForRequest(aStatus);
|
|
1181 |
CHECKPOINT(aStatus.Int(), KErrNone, _L("GT83-TPHBK-008.013")) ;
|
|
1182 |
|
|
1183 |
User::WaitForRequest(status2);
|
|
1184 |
if (status2==KErrNotSupported)
|
|
1185 |
{
|
|
1186 |
// Notification is not supported by phonebook store
|
|
1187 |
INFO_PRINTF1(_L("Phonebook Store Delete Notification is NOT Supported"));
|
|
1188 |
}
|
|
1189 |
else
|
|
1190 |
{
|
|
1191 |
// This should happen since this notification is supported by phonebook store
|
|
1192 |
INFO_PRINTF1(_L("Phonebook Store Delete Notification IS Supported - Succeeded"));
|
|
1193 |
}
|
|
1194 |
}
|
|
1195 |
|
|
1196 |
// EntryChangedNotificationCancel Request
|
|
1197 |
status1= KErrNone; // reset status variable
|
|
1198 |
simPhBk.NotifyStoreEvent(status1, eventToReturn, index1);
|
|
1199 |
simPhBk.CancelAsyncRequest(EMobilePhoneStoreNotifyStoreEvent);
|
|
1200 |
User::WaitForRequest(status1);
|
|
1201 |
CHECKPOINT(status1.Int(), KErrCancel, _L("GT83-TPHBK-008.16")) ;
|
|
1202 |
|
|
1203 |
// Cancel Notification Request after 2 seconds
|
|
1204 |
status1= KErrNone; // reset status variable
|
|
1205 |
simPhBk.NotifyStoreEvent(status1, eventToReturn, index1);
|
|
1206 |
User::After(2000000L);
|
|
1207 |
simPhBk.CancelAsyncRequest(EMobilePhoneStoreNotifyStoreEvent);
|
|
1208 |
User::WaitForRequest(status1);
|
|
1209 |
|
|
1210 |
INFO_PRINTF2(TRefByValue<const TDesC>(_L("Cancel Status = %d")), status1.Int());
|
|
1211 |
TESTL(status1==KErrCancel);
|
|
1212 |
|
|
1213 |
// Now write the same entry again
|
|
1214 |
simPhBk.Write(aStatus, pbData, index);
|
|
1215 |
User::WaitForRequest(aStatus);
|
|
1216 |
CHECKPOINT(aStatus.Int(), KErrNone, _L("GT83-TPHBK-0")) ;
|
|
1217 |
|
|
1218 |
simPhBk.Delete(aStatus, 1); // Deleting the last added entry so that the test ends "clean".
|
|
1219 |
User::WaitForRequest(aStatus);
|
|
1220 |
if (iMTSupported)
|
|
1221 |
{
|
|
1222 |
combPhBk.Close();
|
|
1223 |
}
|
|
1224 |
}
|
|
1225 |
|
|
1226 |
simPhBk.Close();
|
|
1227 |
|
|
1228 |
delete pbBuffer;
|
|
1229 |
return TestStepResult();
|
|
1230 |
}
|
|
1231 |
//------------------------------------------------------------------
|
|
1232 |
|
|
1233 |
CTestInvalidOps::CTestInvalidOps()
|
|
1234 |
/** Each test step initialises it's own name
|
|
1235 |
*/
|
|
1236 |
{
|
|
1237 |
// store the name of this test case
|
|
1238 |
// this is the name that is used by the script file
|
|
1239 |
SetTestStepName(_L("testInvalidOps"));
|
|
1240 |
}
|
|
1241 |
//------------------------------------------------------------------
|
|
1242 |
|
|
1243 |
TVerdict CTestInvalidOps::doTestStepL( void )
|
|
1244 |
/**
|
|
1245 |
* Stress test. Tries to perform invalid operations on the phonebook to make sure the
|
|
1246 |
* phone errors these operations accordingly.
|
|
1247 |
* @test GT83-TPHBK-001.06 Test opening an ICC-based phonebook of abbreviated dialling numbers
|
|
1248 |
* @test GT83-TPHBK-002.06 Test closing an ICC-based phonebook of abbreviated dialling numbers
|
|
1249 |
* @test GT83-TPHBK-003.06 Test retrieval of the phone book store info and capabilities of an ICC-based phonebook of abbreviated dialling numbers
|
|
1250 |
*/
|
|
1251 |
{
|
|
1252 |
RMobilePhoneBookStore simPhBk;
|
|
1253 |
RMobilePhoneBookStore::TMobilePhoneBookInfoV1 aInfo;
|
|
1254 |
RMobilePhoneBookStore::TMobilePhoneBookInfoV1 *bInfo;
|
|
1255 |
TRequestStatus aStatus;
|
|
1256 |
|
|
1257 |
TInt ret = simPhBk.Open(iPhone, KETelIccAdnPhoneBook) ;
|
|
1258 |
if(ret != KErrNone)
|
|
1259 |
{
|
|
1260 |
ERR_PRINTF1(_L("Does SIM.TSY support KETelIccAdnPhoneBook?")) ;
|
|
1261 |
simPhBk.Close() ;
|
|
1262 |
return EFail;
|
|
1263 |
}
|
|
1264 |
|
|
1265 |
TBuf8<KPBDataClientBuf> pbData; // Client reserved space for phonebook data
|
|
1266 |
TInt maxNumber, index(0), numEntries(1);
|
|
1267 |
|
|
1268 |
CPhoneBookBuffer* pbBuffer=new(ELeave) CPhoneBookBuffer(); // used to read/write phonebook entries
|
|
1269 |
pbBuffer->Set(&pbData); // Set it to point to the Client buffer
|
|
1270 |
|
|
1271 |
// Read and write past the end of phone book - First ask the phone what is the maximum number of
|
|
1272 |
// entries, then tries to write past the max index!
|
|
1273 |
|
|
1274 |
RMobilePhoneBookStore::TMobilePhoneBookInfoV1Pckg aInfoPckg(aInfo);
|
|
1275 |
simPhBk.GetInfo(aStatus, aInfoPckg);
|
|
1276 |
User::WaitForRequest(aStatus);
|
|
1277 |
CHECKPOINT(aStatus.Int(), KErrNone, _L("GT83-TPHBK-003.06")) ;
|
|
1278 |
bInfo = &aInfoPckg();
|
|
1279 |
|
|
1280 |
maxNumber = bInfo->iTotalEntries;
|
|
1281 |
|
|
1282 |
// Write an entry beyond the returned phonebook limit
|
|
1283 |
index = maxNumber + 1;
|
|
1284 |
|
|
1285 |
// convert number into TLV format and append it to allocated buffer
|
|
1286 |
ret=pbBuffer->PutTagAndValue((TUint8)RMobilePhoneBookStore::ETagPBNumber, KAnnPhoneNum);
|
|
1287 |
TESTL(ret == KErrNone) ;
|
|
1288 |
|
|
1289 |
// convert number type into TLV format and append it to allocated buffer
|
|
1290 |
ret=pbBuffer->PutTagAndValue((TUint8)RMobilePhoneBookStore::ETagPBTonNpi, (TUint8)RMobilePhone::EUnknownNumber);
|
|
1291 |
TESTL(ret == KErrNone) ;
|
|
1292 |
|
|
1293 |
// convert text into TLV format and append it to allocated buffer
|
|
1294 |
ret=pbBuffer->PutTagAndValue((TUint8)RMobilePhoneBookStore::ETagPBText, KAnnText);
|
|
1295 |
TESTL(ret == KErrNone) ;
|
|
1296 |
|
|
1297 |
simPhBk.Write(aStatus, pbData, index);
|
|
1298 |
User::WaitForRequest(aStatus); // Write request
|
|
1299 |
TESTL(aStatus == KErrArgument) ; // Should not accept Phone book entry maxNumber + 1
|
|
1300 |
// Anuli (12/12/01) changed from KErrGeneral to KErrArgument
|
|
1301 |
pbData.FillZ(); // Clear the buffer
|
|
1302 |
pbData.Zero();
|
|
1303 |
|
|
1304 |
// Read that entry
|
|
1305 |
index=maxNumber + 1;
|
|
1306 |
simPhBk.Read(aStatus, index, numEntries, pbData);
|
|
1307 |
User::WaitForRequest(aStatus);
|
|
1308 |
TESTL(aStatus==KErrArgument); // There should be no entry written
|
|
1309 |
|
|
1310 |
// Delete an entry beyond the returned phonebook limit
|
|
1311 |
simPhBk.Delete(aStatus, maxNumber + 1000L); // Testing to delete an impossible indexed entry
|
|
1312 |
User::WaitForRequest(aStatus);
|
|
1313 |
TESTL(aStatus == KErrArgument) ;
|
|
1314 |
|
|
1315 |
// Write text field too long - 62 character is more than 60 defined in config file
|
|
1316 |
index = 1;
|
|
1317 |
|
|
1318 |
// convert number into TLV format and append it to allocated buffer
|
|
1319 |
ret=pbBuffer->PutTagAndValue((TUint8)RMobilePhoneBookStore::ETagPBNumber, KAnnPhoneNum);
|
|
1320 |
TESTL(ret == KErrNone) ;
|
|
1321 |
|
|
1322 |
// convert number type into TLV format and append it to allocated buffer
|
|
1323 |
ret=pbBuffer->PutTagAndValue((TUint8)RMobilePhoneBookStore::ETagPBTonNpi, (TUint8)RMobilePhone::EUnknownNumber);
|
|
1324 |
TESTL(ret == KErrNone) ;
|
|
1325 |
|
|
1326 |
// convert text into TLV format and append it to allocated buffer
|
|
1327 |
ret=pbBuffer->PutTagAndValue((TUint8)RMobilePhoneBookStore::ETagPBText, KTextTooLong);
|
|
1328 |
TESTL(ret == KErrNone) ;
|
|
1329 |
|
|
1330 |
simPhBk.Write(aStatus, pbData, index);
|
|
1331 |
User::WaitForRequest(aStatus); // Write request
|
|
1332 |
if (aStatus==KErrNone)
|
|
1333 |
{
|
|
1334 |
INFO_PRINTF1(_L("Phone book does not error writing a too long name tag!"));
|
|
1335 |
simPhBk.Delete(aStatus, index);
|
|
1336 |
User::WaitForRequest(aStatus);
|
|
1337 |
TESTL(aStatus == KErrNone) ;
|
|
1338 |
}
|
|
1339 |
else
|
|
1340 |
{
|
|
1341 |
TESTL(aStatus == KErrOverflow) ;
|
|
1342 |
}
|
|
1343 |
|
|
1344 |
// Write number field too long - assume 80 characters is more than 50 defined in config file
|
|
1345 |
index = 1;
|
|
1346 |
// convert number into TLV format and append it to allocated buffer
|
|
1347 |
ret=pbBuffer->PutTagAndValue((TUint8)RMobilePhoneBookStore::ETagPBNumber, KNumberTooLong);
|
|
1348 |
TESTL(ret == KErrNone) ;
|
|
1349 |
|
|
1350 |
// convert number type into TLV format and append it to allocated buffer
|
|
1351 |
ret=pbBuffer->PutTagAndValue((TUint8)RMobilePhoneBookStore::ETagPBTonNpi, (TUint8)RMobilePhone::EUnknownNumber);
|
|
1352 |
TESTL(ret == KErrNone) ;
|
|
1353 |
|
|
1354 |
// convert text into TLV format and append it to allocated buffer
|
|
1355 |
ret=pbBuffer->PutTagAndValue((TUint8)RMobilePhoneBookStore::ETagPBText, KAnnText);
|
|
1356 |
TESTL(ret == KErrNone) ;
|
|
1357 |
|
|
1358 |
simPhBk.Write(aStatus, pbData, index);
|
|
1359 |
User::WaitForRequest(aStatus); // Write request
|
|
1360 |
if (aStatus==KErrNone)
|
|
1361 |
{
|
|
1362 |
INFO_PRINTF1(_L("Phone book does not error writing a too long number field!"));
|
|
1363 |
simPhBk.Delete(aStatus, index);
|
|
1364 |
User::WaitForRequest(aStatus);
|
|
1365 |
CHECKPOINT(aStatus.Int(), KErrNone, _L("GT83-TPHBK-0")) ;
|
|
1366 |
}
|
|
1367 |
else
|
|
1368 |
{
|
|
1369 |
CHECKPOINT(aStatus.Int(), KErrOverflow, _L("GT83-TPHBK-0")) ;
|
|
1370 |
}
|
|
1371 |
|
|
1372 |
|
|
1373 |
// Write International TON! Some phones do not support this.
|
|
1374 |
index = 1;
|
|
1375 |
|
|
1376 |
// convert number into TLV format and append it to allocated buffer
|
|
1377 |
ret=pbBuffer->PutTagAndValue((TUint8)RMobilePhoneBookStore::ETagPBNumber, KAnnPhoneNum);
|
|
1378 |
CHECKPOINT(ret, KErrNone, _L("GT83-TPHBK-0")) ;
|
|
1379 |
|
|
1380 |
// convert number type into TLV format and append it to allocated buffer
|
|
1381 |
ret=pbBuffer->PutTagAndValue((TUint8)RMobilePhoneBookStore::ETagPBTonNpi, (TUint8)RMobilePhone::EInternationalNumber);
|
|
1382 |
CHECKPOINT(ret, KErrNone, _L("GT83-TPHBK-0")) ;
|
|
1383 |
|
|
1384 |
// convert text into TLV format and append it to allocated buffer
|
|
1385 |
ret=pbBuffer->PutTagAndValue((TUint8)RMobilePhoneBookStore::ETagPBText, KAnnText);
|
|
1386 |
CHECKPOINT(ret, KErrNone, _L("GT83-TPHBK-0")) ;
|
|
1387 |
|
|
1388 |
simPhBk.Write(aStatus, pbData, index);
|
|
1389 |
User::WaitForRequest(aStatus); // Write request
|
|
1390 |
if (aStatus==KErrNone)
|
|
1391 |
{
|
|
1392 |
index=maxNumber + 1;
|
|
1393 |
simPhBk.Read(aStatus, index, numEntries, pbData);
|
|
1394 |
User::WaitForRequest(aStatus);
|
|
1395 |
INFO_PRINTF1(_L("Phone book does not error write with International TOA "));
|
|
1396 |
simPhBk.Delete(aStatus, 1);
|
|
1397 |
User::WaitForRequest(aStatus);
|
|
1398 |
}
|
|
1399 |
else
|
|
1400 |
CHECKPOINT(aStatus.Int(), KErrGeneral, _L("GT83-TPHBK-0")) ;
|
|
1401 |
|
|
1402 |
User::After(5000000L);
|
|
1403 |
|
|
1404 |
simPhBk.Close();
|
|
1405 |
delete pbBuffer;
|
|
1406 |
return TestStepResult();
|
|
1407 |
}
|
|
1408 |
//------------------------------------------------------------------
|
|
1409 |
|
|
1410 |
CTestAdvancedPhBk::CTestAdvancedPhBk()
|
|
1411 |
/** Each test step initialises it's own name
|
|
1412 |
*/
|
|
1413 |
{
|
|
1414 |
// store the name of this test case
|
|
1415 |
// this is the name that is used by the script file
|
|
1416 |
SetTestStepName(_L("testAdvancedPhBk"));
|
|
1417 |
}
|
|
1418 |
//------------------------------------------------------------------
|
|
1419 |
|
|
1420 |
TVerdict CTestAdvancedPhBk::doTestStepL( void )
|
|
1421 |
/**
|
|
1422 |
* This function opens an Advanced Gsm SIM PhoneBook, then proceeds to write and then
|
|
1423 |
* delete 'KFillTo' entries from the phone book.
|
|
1424 |
* @test GT83-TPHBK-001.06 Test opening an ICC-based phonebook of abbreviated dialling numbers
|
|
1425 |
* @test GT83-TPHBK-002.06 Test closing an ICC-based phonebook of abbreviated dialling numbers
|
|
1426 |
* @test GT83-TPHBK-003.06 Test retrieval of the phone book store info and capabilities of an ICC-based phonebook of abbreviated dialling numbers
|
|
1427 |
* @test GT83-TPHBK-007.06 "Test writing a single phonebook entry to a specified location in an ICC-based phonebook containing voice mailbox numbers, where the location is empty"
|
|
1428 |
* @test GT83-TPHBK-008.06 Test deleting an individual phonebook entry from an ICC-based phonebook of abbreviated dialling numbers
|
|
1429 |
*/
|
|
1430 |
{
|
|
1431 |
const TInt KFillTo=30;
|
|
1432 |
|
|
1433 |
TInt ret=KErrNone;
|
|
1434 |
TRequestStatus aStatus;
|
|
1435 |
RMobilePhoneBookStore::TMobilePhoneBookInfoV1 aPhoneStoreInfob;
|
|
1436 |
RMobilePhoneBookStore::TMobilePhoneBookInfoV1Pckg aPhoneStoreInfoPckgb(aPhoneStoreInfob);
|
|
1437 |
RMobilePhoneBookStore simPhBk;
|
|
1438 |
|
|
1439 |
TBuf8<KPBDataClientBuf> pbData; // Client reserved space for phonebook data
|
|
1440 |
|
|
1441 |
_LIT(KTel,"1632960000%02d");
|
|
1442 |
_LIT(KText,"Tel %02d");
|
|
1443 |
TBuf<15> text(KTel), number(KText);
|
|
1444 |
|
|
1445 |
TInt index(1);
|
|
1446 |
|
|
1447 |
ret=simPhBk.Open(iPhone, KETelIccAdnPhoneBook());
|
|
1448 |
if( ret == KErrNone)
|
|
1449 |
{
|
|
1450 |
CHECKPOINT(ret, KErrNone, _L("GT83-TPHBK-001.06")) ;
|
|
1451 |
|
|
1452 |
simPhBk.DeleteAll(aStatus);
|
|
1453 |
User::WaitForRequest(aStatus);
|
|
1454 |
|
|
1455 |
// Write the entries
|
|
1456 |
INFO_PRINTF1(_L("Fill the 1st 30 locations in the SIM phonebook..."));
|
|
1457 |
|
|
1458 |
simPhBk.GetInfo(aStatus, aPhoneStoreInfoPckgb);
|
|
1459 |
User::WaitForRequest(aStatus);
|
|
1460 |
|
|
1461 |
CHECKPOINT(aStatus.Int(), KErrNone, _L("GT83-TPHBK-003.06")) ;
|
|
1462 |
aPhoneStoreInfob = aPhoneStoreInfoPckgb();
|
|
1463 |
TInt used=aPhoneStoreInfob.iUsedEntries ;
|
|
1464 |
|
|
1465 |
TESTL(used==0);
|
|
1466 |
|
|
1467 |
CPhoneBookBuffer* pbBuffer = new(ELeave) CPhoneBookBuffer(); // used to write phonebook data
|
|
1468 |
pbBuffer->Set(&pbData); // Set it to point to the Client buffer
|
|
1469 |
|
|
1470 |
// Fields supported by this phonebook are returned to client as capabilities
|
|
1471 |
// in aPhoneStoreInfoPckgb. It is assumed that all GSM phonebook fields (index, tel num,
|
|
1472 |
// type and name) are supported even though that part of the code has to be tested as well.
|
|
1473 |
|
|
1474 |
while (used<KFillTo)
|
|
1475 |
{
|
|
1476 |
// First specify starting index and set iNumofEntries to 1, since it is only
|
|
1477 |
// possible to write one entry at a time
|
|
1478 |
|
|
1479 |
number.FillZ(); // Reset previous values
|
|
1480 |
number.Zero();
|
|
1481 |
text.FillZ();
|
|
1482 |
text.Zero();
|
|
1483 |
pbData.FillZ();
|
|
1484 |
pbData.Zero();
|
|
1485 |
|
|
1486 |
// convert number into TLV format and append it to allocated buffer
|
|
1487 |
number.Format(KTel(), index);
|
|
1488 |
ret=pbBuffer->PutTagAndValue((TUint8)RMobilePhoneBookStore::ETagPBNumber, number);
|
|
1489 |
TESTL(ret == KErrNone) ;
|
|
1490 |
|
|
1491 |
// convert number type into TLV format and append it to allocated buffer
|
|
1492 |
ret=pbBuffer->PutTagAndValue((TUint8)RMobilePhoneBookStore::ETagPBTonNpi, (TUint8)RMobilePhone::EUnknownNumber);
|
|
1493 |
|
|
1494 |
text.Format(KText(), index);
|
|
1495 |
INFO_PRINTF2(_L("Writing \'%S\'"),&text);
|
|
1496 |
// convert text into TLV format and append it to allocated buffer
|
|
1497 |
ret=pbBuffer->PutTagAndValue((TUint8)RMobilePhoneBookStore::ETagPBText, text);
|
|
1498 |
|
|
1499 |
simPhBk.Write(aStatus, pbData, index);
|
|
1500 |
User::WaitForRequest(aStatus);
|
|
1501 |
CHECKPOINT(aStatus.Int(), KErrNone, _L("GT83-TPHBK-007.06"));
|
|
1502 |
used++;
|
|
1503 |
index++;
|
|
1504 |
} // end while
|
|
1505 |
|
|
1506 |
delete pbBuffer;
|
|
1507 |
}
|
|
1508 |
else
|
|
1509 |
{
|
|
1510 |
INFO_PRINTF1(_L("Does SIM.TSY support KETelIccAdnPhoneBook?")) ;
|
|
1511 |
}
|
|
1512 |
simPhBk.Close();
|
|
1513 |
|
|
1514 |
// Delete the entries //
|
|
1515 |
INFO_PRINTF1(_L("Re-opening phonebook..."));
|
|
1516 |
ret=simPhBk.Open(iPhone, KETelIccAdnPhoneBook());
|
|
1517 |
if( ret == KErrNone)
|
|
1518 |
{
|
|
1519 |
CHECKPOINT(ret, KErrNone, _L("GT83-TPHBK-001.06")) ;
|
|
1520 |
simPhBk.GetInfo(aStatus, aPhoneStoreInfoPckgb);
|
|
1521 |
User::WaitForRequest(aStatus);
|
|
1522 |
CHECKPOINT(aStatus.Int(), KErrNone, _L("GT83-TPHBK-003.06")) ;
|
|
1523 |
aPhoneStoreInfob = aPhoneStoreInfoPckgb();
|
|
1524 |
INFO_PRINTF1(_L("Deleting the entries..."));
|
|
1525 |
for (int iy=1;iy<=KFillTo;++iy)
|
|
1526 |
{
|
|
1527 |
INFO_PRINTF2(_L("Deleting %03d"),iy);
|
|
1528 |
simPhBk.Delete(aStatus, iy);
|
|
1529 |
User::WaitForRequest(aStatus);
|
|
1530 |
CHECKPOINT(aStatus.Int(), KErrNone, _L("GT83-TPHBK-008.06"));
|
|
1531 |
}
|
|
1532 |
}
|
|
1533 |
else
|
|
1534 |
{
|
|
1535 |
INFO_PRINTF1(_L("Does SIM.TSY support KETelIccAdnPhoneBook?")) ;
|
|
1536 |
}
|
|
1537 |
simPhBk.Close();
|
|
1538 |
return TestStepResult();
|
|
1539 |
}
|
|
1540 |
//------------------------------------------------------------------
|
|
1541 |
|
|
1542 |
CRetrievalOfWholePhoneBook::CRetrievalOfWholePhoneBook()
|
|
1543 |
/** Each test step initialises it's own name
|
|
1544 |
*/
|
|
1545 |
{
|
|
1546 |
// store the name of this test case
|
|
1547 |
// this is the name that is used by the script file
|
|
1548 |
SetTestStepName(_L("RetrievalOfWholePhoneBook"));
|
|
1549 |
}
|
|
1550 |
//------------------------------------------------------------------
|
|
1551 |
|
|
1552 |
TVerdict CRetrievalOfWholePhoneBook::doTestStepL( void )
|
|
1553 |
/**
|
|
1554 |
* Detected Network test. This function gets the number of available networks
|
|
1555 |
* and information on these networks. Also tests some Cancel Requests.
|
|
1556 |
* @test GT83-TPHBK-001.06 Test opening an ICC-based phonebook of abbreviated dialling numbers
|
|
1557 |
* @test GT83-TPHBK-002.06 Test closing an ICC-based phonebook of abbreviated dialling numbers
|
|
1558 |
* @test GT83-TPHBK-003.06 Test retrieval of the phone book store info and capabilities of an ICC-based phonebook of abbreviated dialling numbers
|
|
1559 |
* @test GT83-TPHBK-004.06 "Obtain total number of slots and number of slots used, using GetInfo method. Test retrieval of the whole list of phone book entries from an ICC-based phonebook of abbreviated dialling numbers"
|
|
1560 |
*/
|
|
1561 |
{
|
|
1562 |
INFO_PRINTF1(_L("==============================="));
|
|
1563 |
INFO_PRINTF1(_L(" Test retrieval of a Phonebook"));
|
|
1564 |
INFO_PRINTF1(_L("==============================="));
|
|
1565 |
INFO_PRINTF1(_L("This test can take up to a minute to complete..."));
|
|
1566 |
|
|
1567 |
RMobilePhoneBookStore simPhBk;
|
|
1568 |
TInt ret = simPhBk.Open(iPhone, KETelIccAdnPhoneBook) ;
|
|
1569 |
if(ret != KErrNone)
|
|
1570 |
{
|
|
1571 |
ERR_PRINTF1(_L("Does SIM.TSY support KETelIccAdnPhoneBook?")) ;
|
|
1572 |
simPhBk.Close() ;
|
|
1573 |
return EFail;
|
|
1574 |
}
|
|
1575 |
|
|
1576 |
// First write 15 entries to the phone
|
|
1577 |
INFO_PRINTF1(_L("Writing 15 entries to the phone"));
|
|
1578 |
WriteBatchOfEntriesToThePhoneL();
|
|
1579 |
|
|
1580 |
CPhoneBookBuffer* pbBuffer=new(ELeave) CPhoneBookBuffer(); // used to read phonebook data
|
|
1581 |
TBuf8<KPBDataClientBuf> pbReadData1; // Client reserved space for phonebook data
|
|
1582 |
TRequestStatus aStatus;
|
|
1583 |
|
|
1584 |
TUint index(1);
|
|
1585 |
TPtrC8 number(NULL,0);
|
|
1586 |
TPtrC8 text(NULL,0);
|
|
1587 |
|
|
1588 |
TUint8 aTagValue(0);
|
|
1589 |
CPhoneBookBuffer::TPhBkTagType aDataType;
|
|
1590 |
TPtrC8 field(NULL,0);
|
|
1591 |
TInt counter(0);
|
|
1592 |
|
|
1593 |
|
|
1594 |
// Get total number of phonebook entires
|
|
1595 |
RMobilePhoneBookStore::TMobilePhoneBookInfoV1 aInfo;
|
|
1596 |
RMobilePhoneBookStore::TMobilePhoneBookInfoV1Pckg aInfoPckg(aInfo);
|
|
1597 |
simPhBk.GetInfo(aStatus, aInfoPckg);
|
|
1598 |
User::WaitForRequest(aStatus);
|
|
1599 |
CHECKPOINT(aStatus.Int(), KErrNone, _L("GT83-TPHBK-003.06")) ;
|
|
1600 |
|
|
1601 |
INFO_PRINTF2(_L("Start retrieving %d phonebook entries"), aInfo.iTotalEntries);
|
|
1602 |
|
|
1603 |
TInt numOfEntries(aInfo.iTotalEntries-1);
|
|
1604 |
simPhBk.Read(aStatus, 1, numOfEntries, pbReadData1);
|
|
1605 |
User::WaitForRequest(aStatus);
|
|
1606 |
CHECKPOINT(aStatus.Int(), KErrNone, _L("GT83-TPHBK-004.06")) ;
|
|
1607 |
|
|
1608 |
// pbReadData1 will contain a batch of retrieved entries, so start by parsing through its
|
|
1609 |
// data to retrieve individual entries
|
|
1610 |
pbBuffer->Set(&pbReadData1); // Set pbBuffer to point to received phonebook data
|
|
1611 |
pbBuffer->StartRead(); // Start reading received phonebook data
|
|
1612 |
while(counter < pbReadData1.Length())
|
|
1613 |
{
|
|
1614 |
TInt ret = pbBuffer->GetTagAndType(aTagValue, aDataType);
|
|
1615 |
if(ret==KErrNotFound) // Reached the end of phonebook data
|
|
1616 |
break;
|
|
1617 |
TESTL(ret == KErrNone) ;
|
|
1618 |
switch(aDataType)
|
|
1619 |
{
|
|
1620 |
case CPhoneBookBuffer::EPhBkTypeInt8:
|
|
1621 |
{
|
|
1622 |
TUint8 int8(0);
|
|
1623 |
counter = counter + 1; // add tag-field only in case that is beginning of new field
|
|
1624 |
if(aTagValue == RMobilePhoneBookStore::ETagPBAdnIndex)
|
|
1625 |
{
|
|
1626 |
pbBuffer->GetValue(int8); //
|
|
1627 |
counter = counter + 1; // 1-byte integer
|
|
1628 |
index = int8;
|
|
1629 |
}
|
|
1630 |
}
|
|
1631 |
break;
|
|
1632 |
|
|
1633 |
case CPhoneBookBuffer::EPhBkTypeInt16:
|
|
1634 |
{
|
|
1635 |
TUint16 int16(0);
|
|
1636 |
pbBuffer->GetValue(int16);
|
|
1637 |
counter = counter + 3; // 2-byte integer + tag-field
|
|
1638 |
}
|
|
1639 |
break;
|
|
1640 |
|
|
1641 |
case CPhoneBookBuffer::EPhBkTypeInt32:
|
|
1642 |
{
|
|
1643 |
TUint32 int32(0);
|
|
1644 |
pbBuffer->GetValue(int32);
|
|
1645 |
counter = counter + 5; // 4-byte integer + tag-field
|
|
1646 |
}
|
|
1647 |
break;
|
|
1648 |
|
|
1649 |
case CPhoneBookBuffer::EPhBkTypeDes16:
|
|
1650 |
{
|
|
1651 |
pbBuffer->GetValue(field);
|
|
1652 |
counter = counter + field.Length() + 3; // add desc length + length-field + tag-field
|
|
1653 |
if(aTagValue == RMobilePhoneBookStore::ETagPBText)
|
|
1654 |
{
|
|
1655 |
text.Set(field);
|
|
1656 |
}
|
|
1657 |
else if(aTagValue == RMobilePhoneBookStore::ETagPBNumber)
|
|
1658 |
{
|
|
1659 |
number.Set(field);
|
|
1660 |
}
|
|
1661 |
}
|
|
1662 |
break;
|
|
1663 |
|
|
1664 |
default:
|
|
1665 |
break;
|
|
1666 |
} // end switch aDataType
|
|
1667 |
|
|
1668 |
// Print each individual entry
|
|
1669 |
if((aTagValue == RMobilePhoneBookStore::ETagPBNewEntry) && (counter>1)) // Only print if all fields retrieved
|
|
1670 |
{
|
|
1671 |
INFO_PRINTF4(_L("%d = >%S< >%S<"), index, &text, &number); // It is not displaying data corectly on the console
|
|
1672 |
}
|
|
1673 |
} // end while
|
|
1674 |
|
|
1675 |
simPhBk.Close();
|
|
1676 |
delete pbBuffer;
|
|
1677 |
INFO_PRINTF1(_L("Deleting the entries"));
|
|
1678 |
ClearPhoneBookL(KETelIccAdnPhoneBook());
|
|
1679 |
return TestStepResult();
|
|
1680 |
}
|
|
1681 |
//------------------------------------------------------------------
|
|
1682 |
|
|
1683 |
CRetrievalOfBatchOfPhoneBookEntries::CRetrievalOfBatchOfPhoneBookEntries()
|
|
1684 |
/** Each test step initialises it's own name
|
|
1685 |
*/
|
|
1686 |
{
|
|
1687 |
// store the name of this test case
|
|
1688 |
// this is the name that is used by the script file
|
|
1689 |
SetTestStepName(_L("RetrievalOfBatchOfPhoneBookEntries"));
|
|
1690 |
}
|
|
1691 |
//------------------------------------------------------------------
|
|
1692 |
|
|
1693 |
TVerdict CRetrievalOfBatchOfPhoneBookEntries::doTestStepL( void )
|
|
1694 |
/**
|
|
1695 |
* Test of retrieval of a batch of phonebook entries. This method is mainly used to test
|
|
1696 |
* removal of partially populated phonebook entries by the MMTSY.
|
|
1697 |
* @test GT83-TPHBK-001.06 Test opening an ICC-based phonebook of abbreviated dialling numbers
|
|
1698 |
* @test GT83-TPHBK-002.06 Test closing an ICC-based phonebook of abbreviated dialling numbers
|
|
1699 |
* @test GT83-TPHBK-005.06 Test retieval of half of the entries from an ICC-based phonebook of abbreviated dialling numbers
|
|
1700 |
*/
|
|
1701 |
{
|
|
1702 |
INFO_PRINTF1(_L("================================================"));
|
|
1703 |
INFO_PRINTF1(_L(" Test retrieval of a Batch of Phonebook Entries"));
|
|
1704 |
INFO_PRINTF1(_L("================================================"));
|
|
1705 |
|
|
1706 |
RMobilePhoneBookStore simPhBk;
|
|
1707 |
TInt ret = simPhBk.Open(iPhone, KETelIccAdnPhoneBook) ;
|
|
1708 |
if(ret != KErrNone)
|
|
1709 |
{
|
|
1710 |
ERR_PRINTF1(_L("Does SIM.TSY support KETelIccAdnPhoneBook?")) ;
|
|
1711 |
simPhBk.Close() ;
|
|
1712 |
return EFail;
|
|
1713 |
}
|
|
1714 |
|
|
1715 |
// First write 15 entries to the phone
|
|
1716 |
INFO_PRINTF1(_L("Writing 15 entries to the phone"));
|
|
1717 |
WriteBatchOfEntriesToThePhoneL();
|
|
1718 |
|
|
1719 |
TRequestStatus aStatus;
|
|
1720 |
TBuf8<KPBDataClientSmallBuf> pbReadData1; // Client reserved space for phonebook data
|
|
1721 |
CPhoneBookBuffer* pbBuffer=new(ELeave) CPhoneBookBuffer(); // used to read phonebook data
|
|
1722 |
|
|
1723 |
INFO_PRINTF1(_L("This test can take up to a minute to complete..."));
|
|
1724 |
TInt startIndex = 3; // Where to start in the phonebook
|
|
1725 |
TInt batchSize = 4; // How many entries to get.
|
|
1726 |
|
|
1727 |
INFO_PRINTF3(_L("Start retrieving a batch of %d phonebook entries with starting index %d"), batchSize, startIndex);
|
|
1728 |
|
|
1729 |
simPhBk.Read(aStatus, startIndex, batchSize, pbReadData1);
|
|
1730 |
User::WaitForRequest(aStatus);
|
|
1731 |
CHECKPOINT(aStatus.Int(), KErrNone, _L("GT83-TPHBK-005.06")) ;
|
|
1732 |
|
|
1733 |
TUint index(0);
|
|
1734 |
TUint temp(0);
|
|
1735 |
TPtrC8 number(NULL,0);
|
|
1736 |
TPtrC8 text(NULL,0);
|
|
1737 |
|
|
1738 |
TUint8 aTagValue(0);
|
|
1739 |
CPhoneBookBuffer::TPhBkTagType aDataType;
|
|
1740 |
TPtrC8 field(NULL,0);
|
|
1741 |
TInt counter(0);
|
|
1742 |
|
|
1743 |
// pbReadData1 will contain a batch of retrieved entries, so start by parsing through its
|
|
1744 |
// data to retrieve/decode individual entries
|
|
1745 |
pbBuffer->Set(&pbReadData1); // Set pbBuffer to point to received phonebook data
|
|
1746 |
pbBuffer->StartRead(); // Start reading received phonebook data
|
|
1747 |
while(counter < pbReadData1.Length())
|
|
1748 |
{
|
|
1749 |
TInt ret = pbBuffer->GetTagAndType(aTagValue, aDataType);
|
|
1750 |
if(ret==KErrNotFound) // Reached the end of phonebook data
|
|
1751 |
break;
|
|
1752 |
TESTL(ret == KErrNone) ;
|
|
1753 |
switch(aDataType)
|
|
1754 |
{
|
|
1755 |
case CPhoneBookBuffer::EPhBkTypeInt8:
|
|
1756 |
{
|
|
1757 |
TUint8 int8(0);
|
|
1758 |
counter = counter + 1; // add tag-field only in case that is beginning of new field
|
|
1759 |
if(aTagValue == RMobilePhoneBookStore::ETagPBAdnIndex)
|
|
1760 |
{
|
|
1761 |
pbBuffer->GetValue(int8); //
|
|
1762 |
counter = counter + 1; // 1-byte integer
|
|
1763 |
index = int8;
|
|
1764 |
}
|
|
1765 |
}
|
|
1766 |
break;
|
|
1767 |
|
|
1768 |
case CPhoneBookBuffer::EPhBkTypeInt16:
|
|
1769 |
{
|
|
1770 |
TUint16 int16(0);
|
|
1771 |
pbBuffer->GetValue(int16);
|
|
1772 |
counter = counter + 3; // 2-byte integer + tag-field
|
|
1773 |
}
|
|
1774 |
break;
|
|
1775 |
|
|
1776 |
case CPhoneBookBuffer::EPhBkTypeInt32:
|
|
1777 |
{
|
|
1778 |
TUint32 int32(0);
|
|
1779 |
pbBuffer->GetValue(int32);
|
|
1780 |
counter = counter + 5; // 4-byte integer + tag-field
|
|
1781 |
}
|
|
1782 |
break;
|
|
1783 |
|
|
1784 |
case CPhoneBookBuffer::EPhBkTypeDes16:
|
|
1785 |
{
|
|
1786 |
pbBuffer->GetValue(field);
|
|
1787 |
counter = counter + field.Length() + 3; // add desc length + length-field + tag-field
|
|
1788 |
if(aTagValue == RMobilePhoneBookStore::ETagPBText)
|
|
1789 |
{
|
|
1790 |
text.Set(field);
|
|
1791 |
}
|
|
1792 |
else if(aTagValue == RMobilePhoneBookStore::ETagPBNumber)
|
|
1793 |
{
|
|
1794 |
number.Set(field);
|
|
1795 |
}
|
|
1796 |
}
|
|
1797 |
break;
|
|
1798 |
|
|
1799 |
default:
|
|
1800 |
break;
|
|
1801 |
} // end switch aDataType
|
|
1802 |
|
|
1803 |
// Print each individual entry
|
|
1804 |
if((aTagValue == RMobilePhoneBookStore::ETagPBNewEntry) && (counter>1)) // Only print if all fields retrieved
|
|
1805 |
{
|
|
1806 |
temp++;
|
|
1807 |
INFO_PRINTF4(_L("%d = >%S< >%S<"), index, &text, &number); // It is not displaying data corectly on the console
|
|
1808 |
}
|
|
1809 |
} // end while
|
|
1810 |
|
|
1811 |
simPhBk.Close();
|
|
1812 |
delete pbBuffer;
|
|
1813 |
|
|
1814 |
INFO_PRINTF1(_L("Deleting the entries"));
|
|
1815 |
ClearPhoneBookL(KETelIccAdnPhoneBook());
|
|
1816 |
return TestStepResult();
|
|
1817 |
}
|
|
1818 |
//------------------------------------------------------------------
|
|
1819 |
|
|
1820 |
CRetrievalOfHalfOfPhoneBookEntries::CRetrievalOfHalfOfPhoneBookEntries()
|
|
1821 |
/** Each test step initialises it's own name
|
|
1822 |
*/
|
|
1823 |
{
|
|
1824 |
// store the name of this test case
|
|
1825 |
// this is the name that is used by the script file
|
|
1826 |
SetTestStepName(_L("RetrievalOfHalfOfPhoneBookEntries"));
|
|
1827 |
}
|
|
1828 |
//------------------------------------------------------------------
|
|
1829 |
|
|
1830 |
TVerdict CRetrievalOfHalfOfPhoneBookEntries::doTestStepL( void )
|
|
1831 |
/**
|
|
1832 |
* Test of retrieval of a half of phonebook entries. This method is mainly used to test
|
|
1833 |
* removal of partially populated phonebook entries by the MMTSY.
|
|
1834 |
* @test GT83-TPHBK-001.06 Test opening an ICC-based phonebook of abbreviated dialling numbers
|
|
1835 |
* @test GT83-TPHBK-002.06 Test closing an ICC-based phonebook of abbreviated dialling numbers
|
|
1836 |
* @test GT83-TPHBK-003.06 Test retrieval of the phone book store info and capabilities of an ICC-based phonebook of abbreviated dialling numbers
|
|
1837 |
* @test GT83-TPHBK-005.06 Test retieval of half of the entries from an ICC-based phonebook of abbreviated dialling numbers
|
|
1838 |
*/
|
|
1839 |
{
|
|
1840 |
RMobilePhoneBookStore::TMobilePhoneBookInfoV1 aPhoneStoreInfob;
|
|
1841 |
RMobilePhoneBookStore::TMobilePhoneBookInfoV1Pckg aPhoneStoreInfoPckgb(aPhoneStoreInfob);
|
|
1842 |
|
|
1843 |
INFO_PRINTF1(_L("================================================"));
|
|
1844 |
INFO_PRINTF1(_L(" Test retrieval of a Batch of Phonebook Entries"));
|
|
1845 |
INFO_PRINTF1(_L("================================================"));
|
|
1846 |
|
|
1847 |
RMobilePhoneBookStore simPhBk;
|
|
1848 |
TInt ret = simPhBk.Open(iPhone,KETelIccAdnPhoneBook) ;
|
|
1849 |
if(ret != KErrNone)
|
|
1850 |
{
|
|
1851 |
ERR_PRINTF1(_L("Does SIM.TSY support KETelIccAdnPhoneBook?")) ;
|
|
1852 |
simPhBk.Close() ;
|
|
1853 |
return EFail;
|
|
1854 |
}
|
|
1855 |
|
|
1856 |
// First write 15 entries to the phone
|
|
1857 |
INFO_PRINTF1(_L("Writing 15 entries to the phone"));
|
|
1858 |
WriteBatchOfEntriesToThePhoneL();
|
|
1859 |
|
|
1860 |
TRequestStatus aStatus;
|
|
1861 |
TBuf8<KPBDataClientBuf> pbReadData1; // Client reserved space for phonebook data
|
|
1862 |
CPhoneBookBuffer* pbBuffer=new(ELeave) CPhoneBookBuffer(); // used to read phonebook data
|
|
1863 |
|
|
1864 |
INFO_PRINTF1(_L("This test can take up to a minute to complete..."));
|
|
1865 |
TInt startIndex = 3; // Where to start in the phonebook
|
|
1866 |
TInt batchSize = 4; // How many entries to get.
|
|
1867 |
|
|
1868 |
simPhBk.GetInfo(aStatus, aPhoneStoreInfoPckgb);
|
|
1869 |
User::WaitForRequest(aStatus);
|
|
1870 |
CHECKPOINT(aStatus.Int(), KErrNone, _L("GT83-TPHBK-003.06")) ;
|
|
1871 |
|
|
1872 |
aPhoneStoreInfob = aPhoneStoreInfoPckgb() ;
|
|
1873 |
batchSize = (aPhoneStoreInfob.iTotalEntries)/2; //50%
|
|
1874 |
|
|
1875 |
INFO_PRINTF3(_L("Start retrieving a batch of %d phonebook entries with starting index %d"), batchSize, startIndex);
|
|
1876 |
|
|
1877 |
simPhBk.Read(aStatus, startIndex, batchSize, pbReadData1);
|
|
1878 |
User::WaitForRequest(aStatus);
|
|
1879 |
CHECKPOINT(aStatus.Int(), KErrNone, _L("GT83-TPHBK-005.06")) ;
|
|
1880 |
|
|
1881 |
TUint index(0);
|
|
1882 |
TUint temp(0);
|
|
1883 |
TPtrC8 number(NULL,0);
|
|
1884 |
TPtrC8 text(NULL,0);
|
|
1885 |
|
|
1886 |
TUint8 aTagValue(0);
|
|
1887 |
CPhoneBookBuffer::TPhBkTagType aDataType;
|
|
1888 |
TPtrC8 field(NULL,0);
|
|
1889 |
TInt counter(0);
|
|
1890 |
|
|
1891 |
// pbReadData1 will contain a batch of retrieved entries, so start by parsing through its
|
|
1892 |
// data to retrieve/decode individual entries
|
|
1893 |
pbBuffer->Set(&pbReadData1); // Set pbBuffer to point to received phonebook data
|
|
1894 |
pbBuffer->StartRead(); // Start reading received phonebook data
|
|
1895 |
while(counter < pbReadData1.Length())
|
|
1896 |
{
|
|
1897 |
TInt ret = pbBuffer->GetTagAndType(aTagValue, aDataType);
|
|
1898 |
if(ret==KErrNotFound) // Reached the end of phonebook data
|
|
1899 |
break;
|
|
1900 |
TESTL(ret == KErrNone) ;
|
|
1901 |
switch(aDataType)
|
|
1902 |
{
|
|
1903 |
case CPhoneBookBuffer::EPhBkTypeInt8:
|
|
1904 |
{
|
|
1905 |
TUint8 int8(0);
|
|
1906 |
counter = counter + 1; // add tag-field only in case that is beginning of new field
|
|
1907 |
if(aTagValue == RMobilePhoneBookStore::ETagPBAdnIndex)
|
|
1908 |
{
|
|
1909 |
pbBuffer->GetValue(int8); //
|
|
1910 |
counter = counter + 1; // 1-byte integer
|
|
1911 |
index = int8;
|
|
1912 |
}
|
|
1913 |
}
|
|
1914 |
break;
|
|
1915 |
|
|
1916 |
case CPhoneBookBuffer::EPhBkTypeInt16:
|
|
1917 |
{
|
|
1918 |
TUint16 int16(0);
|
|
1919 |
pbBuffer->GetValue(int16);
|
|
1920 |
counter = counter + 3; // 2-byte integer + tag-field
|
|
1921 |
}
|
|
1922 |
break;
|
|
1923 |
|
|
1924 |
case CPhoneBookBuffer::EPhBkTypeInt32:
|
|
1925 |
{
|
|
1926 |
TUint32 int32(0);
|
|
1927 |
pbBuffer->GetValue(int32);
|
|
1928 |
counter = counter + 5; // 4-byte integer + tag-field
|
|
1929 |
}
|
|
1930 |
break;
|
|
1931 |
|
|
1932 |
case CPhoneBookBuffer::EPhBkTypeDes16:
|
|
1933 |
{
|
|
1934 |
pbBuffer->GetValue(field);
|
|
1935 |
counter = counter + field.Length() + 3; // add desc length + length-field + tag-field
|
|
1936 |
if(aTagValue == RMobilePhoneBookStore::ETagPBText)
|
|
1937 |
{
|
|
1938 |
text.Set(field);
|
|
1939 |
}
|
|
1940 |
else if(aTagValue == RMobilePhoneBookStore::ETagPBNumber)
|
|
1941 |
{
|
|
1942 |
number.Set(field);
|
|
1943 |
}
|
|
1944 |
}
|
|
1945 |
break;
|
|
1946 |
|
|
1947 |
default:
|
|
1948 |
break;
|
|
1949 |
} // end switch aDataType
|
|
1950 |
|
|
1951 |
// Print each individual entry
|
|
1952 |
if((aTagValue == RMobilePhoneBookStore::ETagPBNewEntry) && (counter>1)) // Only print if all fields retrieved
|
|
1953 |
{
|
|
1954 |
temp++;
|
|
1955 |
INFO_PRINTF4(_L("%d = >%S< >%S<"), index, &text, &number); // It is not displaying data corectly on the console
|
|
1956 |
}
|
|
1957 |
} // end while
|
|
1958 |
|
|
1959 |
simPhBk.Close();
|
|
1960 |
delete pbBuffer;
|
|
1961 |
|
|
1962 |
INFO_PRINTF1(_L("Deleting the entries"));
|
|
1963 |
ClearPhoneBookL(KETelIccAdnPhoneBook());
|
|
1964 |
return TestStepResult();
|
|
1965 |
}
|
|
1966 |
|
|
1967 |
//------------------------------------------------------------------
|
|
1968 |
|
|
1969 |
CTestAllPhBooks::CTestAllPhBooks()
|
|
1970 |
/** Each test step initialises it's own name
|
|
1971 |
*/
|
|
1972 |
{
|
|
1973 |
// store the name of this test case
|
|
1974 |
// this is the name that is used by the script file
|
|
1975 |
SetTestStepName(_L("TestAllPhBooks"));
|
|
1976 |
}
|
|
1977 |
//------------------------------------------------------------------
|
|
1978 |
|
|
1979 |
TVerdict CTestAllPhBooks::doTestStepL( void )
|
|
1980 |
{
|
|
1981 |
// Added during port to test execute
|
|
1982 |
// Not part of original test
|
|
1983 |
// This test step seems to rely on state from previous steps which it should not
|
|
1984 |
// Should be reviewed!!!!!!
|
|
1985 |
// Contractor - December 2005
|
|
1986 |
// vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
|
|
1987 |
CSimPhBkTestStepBase::ClearPhoneBookL(KETelIccAdnPhoneBook());
|
|
1988 |
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
1989 |
|
|
1990 |
//I'm very sorry for such code,
|
|
1991 |
//but I have troubles with CW, thus when I
|
|
1992 |
//have my personal copy I'll sort it out better way.
|
|
1993 |
|
|
1994 |
iPhBkNames[0].iPhBkName = KETelMeDialledPhoneBook ;
|
|
1995 |
iPhBkNames[0].iPhBkID = 1 ; //"ME_DIALLEDPHONEBOOK");
|
|
1996 |
|
|
1997 |
iPhBkNames[1].iPhBkName = KETelMeMissedPhoneBook ;
|
|
1998 |
iPhBkNames[1].iPhBkID = 2 ; //"ME_MISSEDPHONEBOOK");
|
|
1999 |
|
|
2000 |
iPhBkNames[2].iPhBkName = KETelMeReceivedPhoneBook ;
|
|
2001 |
iPhBkNames[2].iPhBkID = 3 ;//"ME_RECEIVEDPHONEBOOK");
|
|
2002 |
|
|
2003 |
iPhBkNames[3].iPhBkName = KETelMeAdnPhoneBook;
|
|
2004 |
iPhBkNames[3].iPhBkID = 4 ; //"ME_ADNPHONEBOOK");
|
|
2005 |
|
|
2006 |
iPhBkNames[4].iPhBkName = KETelIccVoiceMailBox;
|
|
2007 |
iPhBkNames[4].iPhBkID = 5 ; //"ICC_VOICEMAILBOX");
|
|
2008 |
|
|
2009 |
iPhBkNames[5].iPhBkName = KETelIccAdnPhoneBook;
|
|
2010 |
iPhBkNames[5].iPhBkID = 6 ; //"ICC_ADNPHONEBOOK");
|
|
2011 |
|
|
2012 |
iPhBkNames[6].iPhBkName = KETelIccFdnPhoneBook;
|
|
2013 |
iPhBkNames[6].iPhBkID = 7 ; //"ICC_FDNPHONEBOOK");
|
|
2014 |
|
|
2015 |
iPhBkNames[7].iPhBkName = KETelIccSdnPhoneBook;
|
|
2016 |
iPhBkNames[7].iPhBkID = 8 ; //"ICC_SDNPHONEBOOK");
|
|
2017 |
|
|
2018 |
iPhBkNames[8].iPhBkName = KETelIccBdnPhoneBook;
|
|
2019 |
iPhBkNames[8].iPhBkID = 10 ; //"ICC_BDNPHONEBOOK");
|
|
2020 |
|
|
2021 |
iPhBkNames[9].iPhBkName = KETelCombinedAdnPhoneBook;
|
|
2022 |
iPhBkNames[9].iPhBkID = 11 ; //"COMB_ADNPHONEBOOK");
|
|
2023 |
|
|
2024 |
iPhBkNames[10].iPhBkName = KETelTaAdnPhoneBook;
|
|
2025 |
iPhBkNames[10].iPhBkID = 12 ; //"TA_ADNPHONEBOOK");
|
|
2026 |
TBuf<32> BookName;
|
|
2027 |
|
|
2028 |
for(TUint index = 0; index<(sizeof(iPhBkNames)/sizeof(TPhBkNameAndID)); index++)
|
|
2029 |
{
|
|
2030 |
BookName.Copy(iPhBkNames[index].iPhBkName);
|
|
2031 |
INFO_PRINTF1(BookName);
|
|
2032 |
//if(IsPhBookSupportedByPhone(iPhone, BookName)) //Is phone book supported by phone?
|
|
2033 |
{
|
|
2034 |
INFO_PRINTF1(_L("RW..."));
|
|
2035 |
TestReadAndWritePhBkL(BookName, iPhBkNames[index].iPhBkID) ;
|
|
2036 |
INFO_PRINTF1(_L("Delete..."));
|
|
2037 |
ClearPhoneBookL(BookName, iPhBkNames[index].iPhBkID) ;
|
|
2038 |
INFO_PRINTF1(_L("Get info..."));
|
|
2039 |
GetPhoneBookInfoL(BookName, iPhBkNames[index].iPhBkID) ;
|
|
2040 |
}
|
|
2041 |
} ;
|
|
2042 |
return TestStepResult();
|
|
2043 |
}
|
|
2044 |
|
|
2045 |
//------------------------------------------------------------------
|
|
2046 |
|
|
2047 |
TPtrC CTestAllPhBooks::MakeCheckPointName(TInt aMajorNum, TInt aMinorNum )
|
|
2048 |
/** Make test id
|
|
2049 |
* @param text buf > 20 symbols
|
|
2050 |
* @param major number
|
|
2051 |
* @param minor number
|
|
2052 |
*/
|
|
2053 |
{
|
|
2054 |
TBuf<32> theBuf ;
|
|
2055 |
//clear old string
|
|
2056 |
theBuf.Copy(_L("GT83-TPHBK-"));
|
|
2057 |
theBuf.AppendFormat(_L("%03d.%03d"), aMajorNum, aMinorNum) ;
|
|
2058 |
return theBuf.Ptr() ;
|
|
2059 |
}
|
|
2060 |
|
|
2061 |
//------------------------------------------------------------------
|
|
2062 |
|
|
2063 |
void CTestAllPhBooks::Print_TMobilePhoneBookInfoV1(RMobilePhoneBookStore::TMobilePhoneBookInfoV1& aArg)
|
|
2064 |
/** Display value of RMobilePhoneBookStore::TMobilePhoneBookInfoV1
|
|
2065 |
* @param value to print
|
|
2066 |
*/
|
|
2067 |
{
|
|
2068 |
INFO_PRINTF1(_L("\tTMobilePhoneBookInfoV1:")) ;
|
|
2069 |
INFO_PRINTF2(_L("iMaxNumLength = %d"), aArg.iMaxNumLength) ;
|
|
2070 |
INFO_PRINTF2( _L("iMaxTextLength = %d"), aArg.iMaxTextLength) ;
|
|
2071 |
Print_TMobilePhoneBookLocation(aArg.iLocation) ;
|
|
2072 |
INFO_PRINTF2(_L("iChangeCounter = %d"), aArg.iChangeCounter) ;
|
|
2073 |
INFO_PRINTF2(_L("iIdentity = %S"), &aArg.iIdentity) ;
|
|
2074 |
Print_TMobilePhoneBookCaps(aArg.iCaps) ;
|
|
2075 |
|
|
2076 |
}
|
|
2077 |
|
|
2078 |
//------------------------------------------------------------------
|
|
2079 |
|
|
2080 |
void CTestAllPhBooks::Print_TMobilePhoneBookLocation(RMobilePhoneBookStore::TMobilePhoneBookLocation& aArg)
|
|
2081 |
/** Display value of enum RMobilePhoneBookStore::TMobilePhoneBookLocation to screen.
|
|
2082 |
* @param value to print
|
|
2083 |
*/
|
|
2084 |
{
|
|
2085 |
switch(aArg)
|
|
2086 |
{
|
|
2087 |
case RMobilePhoneBookStore::ELocationUnknown:
|
|
2088 |
INFO_PRINTF1(_L("Value of enum is RMobilePhoneBookStore::ELocationUnknown")) ;
|
|
2089 |
break ;
|
|
2090 |
case RMobilePhoneBookStore::ELocationIccMemory:
|
|
2091 |
INFO_PRINTF1(_L("Value of enum is RMobilePhoneBookStore::ELocationIccMemory")) ;
|
|
2092 |
break ;
|
|
2093 |
case RMobilePhoneBookStore::ELocationPhoneMemory:
|
|
2094 |
INFO_PRINTF1(_L("Value of enum is RMobilePhoneBookStore::ELocationPhoneMemory")) ;
|
|
2095 |
break ;
|
|
2096 |
case RMobilePhoneBookStore::ELocationExternalMemory:
|
|
2097 |
INFO_PRINTF1(_L("Value of enum is RMobilePhoneBookStore::ELocationExternalMemory")) ;
|
|
2098 |
break ;
|
|
2099 |
case RMobilePhoneBookStore::ELocationCombinedMemory:
|
|
2100 |
INFO_PRINTF1(_L("Value of enum is RMobilePhoneBookStore::ELocationCombinedMemory")) ;
|
|
2101 |
break ;
|
|
2102 |
}
|
|
2103 |
}
|
|
2104 |
|
|
2105 |
//------------------------------------------------------------------
|
|
2106 |
|
|
2107 |
void CTestAllPhBooks::Print_TMobilePhoneBookCaps(TUint32 aArg)
|
|
2108 |
/** Display value of enum RMobilePhoneBookStore::TMobilePhoneBookCaps to screen.
|
|
2109 |
* @param value to print
|
|
2110 |
*/
|
|
2111 |
{
|
|
2112 |
if(aArg & RMobilePhoneBookStore::KCapsRestrictedWriteAccess)
|
|
2113 |
{
|
|
2114 |
INFO_PRINTF1(_L("Has a flag TMobilePhoneBookCaps::KCapsRestrictedWriteAccess")) ;
|
|
2115 |
}
|
|
2116 |
if(aArg & RMobilePhoneBookStore::KCapsSecondNameUsed )
|
|
2117 |
{
|
|
2118 |
INFO_PRINTF1(_L("Has a flag TMobilePhoneBookCaps::KCapsSecondNameUsed ")) ;
|
|
2119 |
}
|
|
2120 |
if(aArg & RMobilePhoneBookStore::KCapsAdditionalNumUsed )
|
|
2121 |
{
|
|
2122 |
INFO_PRINTF1(_L("Has a flag TMobilePhoneBookCaps::KCapsAdditionalNumUsed ")) ;
|
|
2123 |
}
|
|
2124 |
if(aArg & RMobilePhoneBookStore::KCapsGroupingUsed )
|
|
2125 |
{
|
|
2126 |
INFO_PRINTF1(_L("Has a flag TMobilePhoneBookCaps::KCapsGroupingUsed ")) ;
|
|
2127 |
}
|
|
2128 |
if(aArg & RMobilePhoneBookStore::KCapsEntryControlUsed )
|
|
2129 |
{
|
|
2130 |
INFO_PRINTF1(_L("Has a flag TMobilePhoneBookCaps::KCapsEntryControlUsed ")) ;
|
|
2131 |
}
|
|
2132 |
if(aArg & RMobilePhoneBookStore::KCapsEmailAddressUsed )
|
|
2133 |
{
|
|
2134 |
INFO_PRINTF1(_L("Has a flag TMobilePhoneBookCaps::KCapsEmailAddressUsed ")) ;
|
|
2135 |
}
|
|
2136 |
if(aArg & RMobilePhoneBookStore::KCapsBearerCapUsed )
|
|
2137 |
{
|
|
2138 |
INFO_PRINTF1(_L("Has a flag TMobilePhoneBookCaps::KCapsBearerCapUsed ")) ;
|
|
2139 |
}
|
|
2140 |
if(aArg & RMobilePhoneBookStore::KCapsSynchronisationUsed)
|
|
2141 |
{
|
|
2142 |
INFO_PRINTF1(_L("Has a flag TMobilePhoneBookCaps::KCapsSynchronisationUsed")) ;
|
|
2143 |
}
|
|
2144 |
}
|
|
2145 |
|
|
2146 |
//------------------------------------------------------------------
|
|
2147 |
|
|
2148 |
TInt CTestAllPhBooks::GetPhoneBookInfoL(const TDesC& aPhoneBookName, TInt aMinorNum)
|
|
2149 |
/**
|
|
2150 |
* This function gets phone book info and prints it.
|
|
2151 |
* @param ph/book name
|
|
2152 |
* @param test ID minor number
|
|
2153 |
* @return error code
|
|
2154 |
* @test GT83-TPHBK-001.00 Test opening a phone book (Generic)
|
|
2155 |
* @test GT83-TPHBK-002.00 Test closing a phone book (Generic)
|
|
2156 |
* @test GT83-TPHBK-003.00 Test retrieval of the phone book store info and capabilities (generic)
|
|
2157 |
*/
|
|
2158 |
{
|
|
2159 |
TRequestStatus aStatus;
|
|
2160 |
RMobilePhoneBookStore thePhBk;
|
|
2161 |
RMobilePhoneBookStore::TMobilePhoneBookInfoV1 aInfo;
|
|
2162 |
RMobilePhoneBookStore::TMobilePhoneBookInfoV1Pckg aInfoPckg(aInfo);
|
|
2163 |
TInt ret=thePhBk.Open(iPhone, aPhoneBookName);
|
|
2164 |
//TEST_CHECKL(ret, KErrNone, _L("GT83-TPHBK-001.00")) ;
|
|
2165 |
if(ret == KErrNotSupported)
|
|
2166 |
{
|
|
2167 |
INFO_PRINTF2(_L("%S phone book isn't supported!"), &aPhoneBookName) ;
|
|
2168 |
thePhBk.Close() ;
|
|
2169 |
return ret;
|
|
2170 |
}
|
|
2171 |
else if(ret != KErrNone )
|
|
2172 |
{ //It doesn have any sence to continue.
|
|
2173 |
INFO_PRINTF2(_L("I can't open %S phone book!"), &aPhoneBookName) ;
|
|
2174 |
//TEST_CHECKL(ret, KErrNone, MakeCheckPointName(1, aMinorNum)) ;
|
|
2175 |
thePhBk.Close() ;
|
|
2176 |
return ret;
|
|
2177 |
}
|
|
2178 |
|
|
2179 |
thePhBk.GetInfo(aStatus, aInfoPckg);
|
|
2180 |
User::WaitForRequest(aStatus);
|
|
2181 |
//TEST_CHECKL(ret, KErrNone, _L("GT83-TPHBK-003.00")) ;
|
|
2182 |
CHECKPOINT(aStatus.Int(), KErrNone, MakeCheckPointName(3, aMinorNum)) ;
|
|
2183 |
aInfo = aInfoPckg() ;
|
|
2184 |
if(aStatus == KErrNone)
|
|
2185 |
{ //Does it have any sence to print?
|
|
2186 |
Print_TMobilePhoneBookInfoV1(aInfo) ;
|
|
2187 |
}
|
|
2188 |
thePhBk.Close() ;
|
|
2189 |
//TEST_CHECKL(ret, KErrNone, _L("GT83-TPHBK-002.00")) ;
|
|
2190 |
return ret;
|
|
2191 |
}
|
|
2192 |
|
|
2193 |
//---------------------------------------------------------------------------
|
|
2194 |
|
|
2195 |
TInt CTestAllPhBooks::ClearPhoneBookL(const TDesC& aPhoneBookName, TInt aMinorNum)
|
|
2196 |
/**
|
|
2197 |
* This function deletes the first 7 entries in the specified Phone Book.
|
|
2198 |
* @param ph/book name
|
|
2199 |
* @param test ID minor number
|
|
2200 |
* @return error code
|
|
2201 |
* @test GT83-TPHBK-001.00 Test opening a phone book (Generic)
|
|
2202 |
* @test GT83-TPHBK-002.00 Test closing a phone book (Generic)
|
|
2203 |
* @test GT83-TPHBK-008.00 Test deleting individual entries from the phone book (Generic)
|
|
2204 |
*/
|
|
2205 |
{
|
|
2206 |
TRequestStatus aStatus;
|
|
2207 |
RMobilePhoneBookStore thePhBk;
|
|
2208 |
TInt ret=thePhBk.Open(iPhone, aPhoneBookName);
|
|
2209 |
//TEST_CHECKL(ret, KErrNone, _L("GT83-TPHBK-001.00")) ;
|
|
2210 |
if(ret == KErrNotSupported)
|
|
2211 |
{
|
|
2212 |
INFO_PRINTF2(_L("%S phone book isn't supported!"), &aPhoneBookName) ;
|
|
2213 |
thePhBk.Close() ;
|
|
2214 |
return ret;
|
|
2215 |
}
|
|
2216 |
else if(ret != KErrNone )
|
|
2217 |
{ //It doesn have any sence to continue.
|
|
2218 |
INFO_PRINTF2(_L("I can't open %S phone book!"), &aPhoneBookName) ;
|
|
2219 |
//TEST_CHECKL(ret, KErrNone, MakeCheckPointName(1, aMinorNum)) ;
|
|
2220 |
thePhBk.Close() ;
|
|
2221 |
return ret;
|
|
2222 |
}
|
|
2223 |
|
|
2224 |
INFO_PRINTF2(_L("Atempt to delete %S phonebook 7 first entries..."), &aPhoneBookName);
|
|
2225 |
|
|
2226 |
TInt i;
|
|
2227 |
for (i=1; i<=7; i++)
|
|
2228 |
{
|
|
2229 |
thePhBk.Delete(aStatus, i);
|
|
2230 |
User::WaitForRequest(aStatus);
|
|
2231 |
if(aStatus!=KErrNotFound)
|
|
2232 |
{
|
|
2233 |
break; //The ph/book just empty!
|
|
2234 |
}
|
|
2235 |
else if (aStatus!=KErrNone)
|
|
2236 |
{
|
|
2237 |
//Something happend
|
|
2238 |
//TEST_CHECKL(1, KErrNone, _L("GT83-TPHBK-008.00")) ;
|
|
2239 |
CHECKPOINT(ret, KErrNone, MakeCheckPointName(8, aMinorNum)) ;
|
|
2240 |
break;
|
|
2241 |
}
|
|
2242 |
}
|
|
2243 |
|
|
2244 |
thePhBk.Close();
|
|
2245 |
//TEST_CHECKL(ret, KErrNone, _L("GT83-TPHBK-002.00")) ;
|
|
2246 |
return ret;
|
|
2247 |
}
|
|
2248 |
|
|
2249 |
//-------------------------------------------------------------------------------
|
|
2250 |
|
|
2251 |
void CTestAllPhBooks::TestReadAndWritePhBkL(const TDesC& aPhoneBookName, TInt aMinorNum )
|
|
2252 |
/**
|
|
2253 |
* This function creates an array of names and telephone numbers which are to be used as
|
|
2254 |
* phone book entries. It then writes these entries synchronously to the SIM phone book
|
|
2255 |
* and reads them back.
|
|
2256 |
* @param phone book name
|
|
2257 |
* @param minor test id number
|
|
2258 |
* @test GT83-TPHBK-001.00 Test opening a phone book (Generic)
|
|
2259 |
* @test GT83-TPHBK-003.00 Test retrieval of the phone book store info and capabilities (generic)
|
|
2260 |
* @test GT83-TPHBK-006.00 Test retrieval of individual entries from the phone book (Generic)
|
|
2261 |
* @test GT83-TPHBK-006.06 Test retrieval of the first entry in an ICC-based phonebook of abbreviated dialling numbers
|
|
2262 |
*/
|
|
2263 |
{
|
|
2264 |
TInt ret=KErrNone;
|
|
2265 |
TRequestStatus aStatus;
|
|
2266 |
RMobilePhoneBookStore simPhBk;
|
|
2267 |
RMobilePhoneBookStore::TMobilePhoneBookInfoV1 aInfo;
|
|
2268 |
RMobilePhoneBookStore::TMobilePhoneBookInfoV1Pckg aInfoPckg(aInfo);
|
|
2269 |
RMobilePhoneBookStore::TMobilePhoneBookInfoV1 *aInfob;
|
|
2270 |
|
|
2271 |
TBuf8<KPBDataClientBuf> pbData, pbReadData1, pbReadData2, pbReadEmpty; // Client reserved space for phonebook data
|
|
2272 |
TInt requestedIndex(0), numOfEntries(1);
|
|
2273 |
TInt i(0), size(KPPBEntriesNum);
|
|
2274 |
|
|
2275 |
ret=simPhBk.Open(iPhone, aPhoneBookName);
|
|
2276 |
//TEST_CHECKL(ret, KErrNone, _L("GT83-TPHBK-001.00")) ;
|
|
2277 |
|
|
2278 |
if(ret == KErrNotSupported)
|
|
2279 |
{
|
|
2280 |
INFO_PRINTF2(_L("%S phone book isn't supported!"), &aPhoneBookName) ;
|
|
2281 |
simPhBk.Close() ;
|
|
2282 |
return ;
|
|
2283 |
}
|
|
2284 |
else if(ret != KErrNone )
|
|
2285 |
{ //It doesn have any sence to continue.
|
|
2286 |
INFO_PRINTF2(_L("I can't open %S phone book!"), &aPhoneBookName) ;
|
|
2287 |
//TEST_CHECKL(ret, KErrNone, MakeCheckPointName(1, aMinorNum)) ;
|
|
2288 |
simPhBk.Close() ;
|
|
2289 |
return ;
|
|
2290 |
}
|
|
2291 |
|
|
2292 |
simPhBk.GetInfo(aStatus, aInfoPckg);
|
|
2293 |
User::WaitForRequest(aStatus);
|
|
2294 |
//TEST_CHECKL(aStatus.Int(), KErrNone, _L("GT83-TPHBK-003.00")) ;
|
|
2295 |
CHECKPOINT(ret, KErrNone, MakeCheckPointName(3, aMinorNum)) ;
|
|
2296 |
aInfob = &aInfoPckg();
|
|
2297 |
|
|
2298 |
|
|
2299 |
// Create array of names and numbers
|
|
2300 |
const TText* names[]={(TText16*)KAnnText.iBuf, (TText16*)KMattSText.iBuf, (TText16*)KAndyText.iBuf,
|
|
2301 |
(TText16*)KMattMText.iBuf,(TText16*)KPaulText.iBuf, (TText16*)KMumAndDadText.iBuf,
|
|
2302 |
(TText16*)KSymbolText.iBuf,(TText16*)KTextTooLong.iBuf};
|
|
2303 |
|
|
2304 |
const TText* numbers[]={(TText16*)KAnnPhoneNum.iBuf, (TText16*)KMattSPhoneNum.iBuf, (TText16*)KAndyPhoneNum.iBuf,
|
|
2305 |
(TText16*)KMattMPhoneNum.iBuf, (TText16*)KPaulPhoneNum.iBuf, (TText16*)KMumAndDadPhoneNum.iBuf,
|
|
2306 |
(TText16*)KSymbolPhoneNum.iBuf,(TText16*)KNumberTooLong.iBuf};
|
|
2307 |
|
|
2308 |
|
|
2309 |
TBuf<KBufSize> entryNumber(numbers[0]);
|
|
2310 |
TBuf<KBufSize> entryName(names[0]);
|
|
2311 |
|
|
2312 |
CPhoneBookBuffer* pbBuffer = new(ELeave) CPhoneBookBuffer();
|
|
2313 |
pbBuffer->Set(&pbData); // Set it to point to the Client buffer
|
|
2314 |
|
|
2315 |
//Is it posible to write anything ?
|
|
2316 |
if (aInfob->iCaps & RMobilePhoneStore::KCapsWriteAccess)
|
|
2317 |
{
|
|
2318 |
// Write the entries to the SIM Phone Book
|
|
2319 |
TInt writeIndex(0);
|
|
2320 |
|
|
2321 |
for (i=1; i<=size; ++i)
|
|
2322 |
{
|
|
2323 |
//first reset the following three local buffers to delete any existing data
|
|
2324 |
entryNumber.FillZ();
|
|
2325 |
entryNumber.Zero();
|
|
2326 |
entryName.FillZ();
|
|
2327 |
entryName.Zero();
|
|
2328 |
pbData.FillZ();
|
|
2329 |
pbData.Zero();
|
|
2330 |
|
|
2331 |
entryNumber=numbers[i-1];
|
|
2332 |
entryName=names[i-1];
|
|
2333 |
|
|
2334 |
// First specify starting index and set iNumofEntries to 1, since it is only
|
|
2335 |
// possible to write one entry at a time
|
|
2336 |
|
|
2337 |
writeIndex = i; // Note that TSY will overwrite any existing data. It is up to
|
|
2338 |
// the Sync to check whether it is the first available entry
|
|
2339 |
|
|
2340 |
// convert number into TLV format and append it to allocated buffer
|
|
2341 |
ret=pbBuffer->PutTagAndValue((TUint8)RMobilePhoneBookStore::ETagPBNumber, entryNumber);
|
|
2342 |
TESTL(ret == KErrNone) ;
|
|
2343 |
|
|
2344 |
// convert type into TLV format and append it to allocated buffer
|
|
2345 |
ret=pbBuffer->PutTagAndValue((TUint8)RMobilePhoneBookStore::ETagPBTonNpi, (TUint8)RMobilePhone::EUnknownNumber);
|
|
2346 |
TESTL(ret == KErrNone) ;
|
|
2347 |
|
|
2348 |
// convert text into TLV format and append it to allocated buffer
|
|
2349 |
ret=pbBuffer->PutTagAndValue((TUint8)RMobilePhoneBookStore::ETagPBText, entryName);
|
|
2350 |
TESTL(ret == KErrNone) ;
|
|
2351 |
|
|
2352 |
simPhBk.Write(aStatus, pbData, writeIndex);
|
|
2353 |
//TEST_CHECKL(ret, KErrNone, _L("GT83-TPHBK-07.00")) ;
|
|
2354 |
User::WaitForRequest(aStatus);
|
|
2355 |
if(aStatus == KErrNotSupported)
|
|
2356 |
{
|
|
2357 |
INFO_PRINTF2(_L("Write operation for %S phone book is not supporded!"), &aPhoneBookName) ;
|
|
2358 |
break ;
|
|
2359 |
}
|
|
2360 |
TEST_CHECKL((aStatus == KErrNone || aStatus == KErrNotSupported), ETrue, MakeCheckPointName(7, aMinorNum)) ;
|
|
2361 |
}
|
|
2362 |
}
|
|
2363 |
else
|
|
2364 |
{
|
|
2365 |
INFO_PRINTF2(_L("Write operation for %S phone book is not supporded!"), &aPhoneBookName) ;
|
|
2366 |
}
|
|
2367 |
|
|
2368 |
if (aInfob->iCaps & RMobilePhoneStore::KCapsReadAccess)
|
|
2369 |
{//Is posible to read this ph/book and does it have any etries?
|
|
2370 |
/* Read the entries back */
|
|
2371 |
TInt index;
|
|
2372 |
TPtrC number(NULL,0);
|
|
2373 |
TPtrC text(NULL,0);
|
|
2374 |
|
|
2375 |
TUint8 aTagValue(0);
|
|
2376 |
CPhoneBookBuffer::TPhBkTagType aDataType;
|
|
2377 |
TPtrC field(NULL,0);
|
|
2378 |
TInt counter(0);
|
|
2379 |
|
|
2380 |
//How many records could we read?
|
|
2381 |
if(-1 == aInfob->iUsedEntries)
|
|
2382 |
{ //Is phone book empty?
|
|
2383 |
size = 0;
|
|
2384 |
}
|
|
2385 |
else
|
|
2386 |
{
|
|
2387 |
size = (size < aInfob->iUsedEntries )? size: aInfob->iUsedEntries;
|
|
2388 |
}
|
|
2389 |
/* Reads Forwads and it reads all entries individually */
|
|
2390 |
for(i=1; i<=size; ++i)
|
|
2391 |
{
|
|
2392 |
//first reset the following three local buffers to delete any existing data
|
|
2393 |
entryNumber.FillZ();
|
|
2394 |
entryNumber.Zero();
|
|
2395 |
entryName.FillZ();
|
|
2396 |
entryName.Zero();
|
|
2397 |
pbData.FillZ();
|
|
2398 |
pbData.Zero();
|
|
2399 |
|
|
2400 |
// reset all loop variables
|
|
2401 |
index = 0;
|
|
2402 |
counter = 0;
|
|
2403 |
aTagValue = 0;
|
|
2404 |
|
|
2405 |
requestedIndex = i;
|
|
2406 |
simPhBk.Read(aStatus, requestedIndex, numOfEntries, pbReadData1);
|
|
2407 |
User::WaitForRequest(aStatus);
|
|
2408 |
//TEST_CHECKL(aStatus.Int(), KErrNone, _L("GT83-TPHBK-006.00")) ;
|
|
2409 |
CHECKPOINT(ret, KErrNone, MakeCheckPointName(6, aMinorNum)) ;
|
|
2410 |
|
|
2411 |
entryNumber=numbers[i-1];
|
|
2412 |
entryName=names[i-1];
|
|
2413 |
|
|
2414 |
// now decode PB data received in TLV format
|
|
2415 |
pbBuffer->Set(&pbReadData1); // Set pbBuffer to point to received phonebook data
|
|
2416 |
pbBuffer->StartRead(); // Start reading received phonebook data
|
|
2417 |
while(counter < pbReadData1.Length())
|
|
2418 |
{
|
|
2419 |
TInt ret = pbBuffer->GetTagAndType(aTagValue, aDataType);
|
|
2420 |
if(ret==KErrNotFound) // Reached the end of phonebook data
|
|
2421 |
break;
|
|
2422 |
TESTL(ret == KErrNone) ;
|
|
2423 |
switch(aDataType)
|
|
2424 |
{
|
|
2425 |
case CPhoneBookBuffer::EPhBkTypeInt8:
|
|
2426 |
{
|
|
2427 |
TUint8 int8(0);
|
|
2428 |
counter = counter + 1; // add tag-field only in case that is beginning of new field
|
|
2429 |
if(aTagValue == RMobilePhoneBookStore::ETagPBAdnIndex)
|
|
2430 |
{
|
|
2431 |
pbBuffer->GetValue(int8); //
|
|
2432 |
counter = counter + 1; // 1-byte integer
|
|
2433 |
index = int8;
|
|
2434 |
}
|
|
2435 |
}
|
|
2436 |
break;
|
|
2437 |
|
|
2438 |
case CPhoneBookBuffer::EPhBkTypeInt16:
|
|
2439 |
{
|
|
2440 |
TUint16 int16(0);
|
|
2441 |
pbBuffer->GetValue(int16);
|
|
2442 |
counter = counter + 3; // 2-byte integer + tag-field
|
|
2443 |
}
|
|
2444 |
break;
|
|
2445 |
|
|
2446 |
case CPhoneBookBuffer::EPhBkTypeInt32:
|
|
2447 |
{
|
|
2448 |
TUint32 int32(0);
|
|
2449 |
pbBuffer->GetValue(int32);
|
|
2450 |
counter = counter + 5; // 4-byte integer + tag-field
|
|
2451 |
}
|
|
2452 |
break;
|
|
2453 |
|
|
2454 |
case CPhoneBookBuffer::EPhBkTypeDes16:
|
|
2455 |
{
|
|
2456 |
pbBuffer->GetValue(field);
|
|
2457 |
counter = counter + field.Length() + 3; // add desc length + length-field + tag-field
|
|
2458 |
if(aTagValue == RMobilePhoneBookStore::ETagPBText)
|
|
2459 |
{
|
|
2460 |
text.Set(field);
|
|
2461 |
}
|
|
2462 |
else if(aTagValue == RMobilePhoneBookStore::ETagPBNumber)
|
|
2463 |
{
|
|
2464 |
number.Set(field);
|
|
2465 |
}
|
|
2466 |
}
|
|
2467 |
break;
|
|
2468 |
|
|
2469 |
default:
|
|
2470 |
break;
|
|
2471 |
} // end switch aDataType
|
|
2472 |
|
|
2473 |
} // end while
|
|
2474 |
|
|
2475 |
|
|
2476 |
//TESTL(TInt(type)==RMobilePhone::EUnknownNumber);
|
|
2477 |
TESTL(number.Compare(entryNumber)==KErrNone);
|
|
2478 |
TESTL(text.Compare(entryName)==KErrNone);
|
|
2479 |
TESTL(index == i) ;
|
|
2480 |
} // end for
|
|
2481 |
|
|
2482 |
|
|
2483 |
// Try to read an empty entry
|
|
2484 |
requestedIndex = i+1; // Now set index to point to last entry in phonebook
|
|
2485 |
simPhBk.Read(aStatus, requestedIndex, numOfEntries, pbReadEmpty);
|
|
2486 |
User::WaitForRequest(aStatus);
|
|
2487 |
#ifndef SIM_TSY
|
|
2488 |
CHECKPOINT(ret, KErrNone, MakeCheckPointName(6, aMinorNum)) ;
|
|
2489 |
//TEST_CHECKL(aStatus.Int(), KErrNone, _L("GT83-TPHBK-006.00")) ; // If asked to read an empty entry, TSY will not return an error
|
|
2490 |
// It is now clients responsibility to ensure a valid index is supplied
|
|
2491 |
#endif
|
|
2492 |
// Read Backwards, one by one
|
|
2493 |
for(i=size; i>0; --i)
|
|
2494 |
{
|
|
2495 |
//first reset the following three local buffers to delete any existing data
|
|
2496 |
entryNumber.FillZ();
|
|
2497 |
entryNumber.Zero();
|
|
2498 |
entryName.FillZ();
|
|
2499 |
entryName.Zero();
|
|
2500 |
pbData.FillZ();
|
|
2501 |
pbData.Zero();
|
|
2502 |
|
|
2503 |
requestedIndex = i;
|
|
2504 |
simPhBk.Read(aStatus, requestedIndex, numOfEntries, pbReadData2);
|
|
2505 |
User::WaitForRequest(aStatus);
|
|
2506 |
//TEST_CHECKL(aStatus.Int(), KErrNone, _L("GT83-TPHBK-006.06")) ;
|
|
2507 |
CHECKPOINT(ret, KErrNone, MakeCheckPointName(6, aMinorNum)) ;
|
|
2508 |
|
|
2509 |
entryNumber=numbers[i-1];
|
|
2510 |
entryName=names[i-1];
|
|
2511 |
|
|
2512 |
// reset all loop variables
|
|
2513 |
index = 0;
|
|
2514 |
counter = 0;
|
|
2515 |
aTagValue = 0;
|
|
2516 |
|
|
2517 |
// now decode PB data received in TLV format
|
|
2518 |
pbBuffer->Set(&pbReadData2); // Set pbBuffer to point to received phonebook data
|
|
2519 |
pbBuffer->StartRead(); // Start reading received phonebook data
|
|
2520 |
while(counter < pbReadData2.Length())
|
|
2521 |
{
|
|
2522 |
TInt ret = pbBuffer->GetTagAndType(aTagValue, aDataType);
|
|
2523 |
if(ret==KErrNotFound) // Reached the end of phonebook data
|
|
2524 |
break;
|
|
2525 |
TESTL(ret == KErrNone) ;
|
|
2526 |
switch(aDataType)
|
|
2527 |
{
|
|
2528 |
case CPhoneBookBuffer::EPhBkTypeInt8:
|
|
2529 |
{
|
|
2530 |
TUint8 int8(0);
|
|
2531 |
counter = counter + 1; // add tag-field only in case that is beginning of new field
|
|
2532 |
if(aTagValue == RMobilePhoneBookStore::ETagPBAdnIndex)
|
|
2533 |
{
|
|
2534 |
pbBuffer->GetValue(int8); //
|
|
2535 |
counter = counter + 1; // 1-byte integer
|
|
2536 |
index = int8;
|
|
2537 |
}
|
|
2538 |
}
|
|
2539 |
break;
|
|
2540 |
|
|
2541 |
case CPhoneBookBuffer::EPhBkTypeInt16:
|
|
2542 |
{
|
|
2543 |
TUint16 int16(0);
|
|
2544 |
pbBuffer->GetValue(int16);
|
|
2545 |
counter = counter + 3; // 2-byte integer + tag-field
|
|
2546 |
}
|
|
2547 |
break;
|
|
2548 |
|
|
2549 |
case CPhoneBookBuffer::EPhBkTypeInt32:
|
|
2550 |
{
|
|
2551 |
TUint32 int32(0);
|
|
2552 |
pbBuffer->GetValue(int32);
|
|
2553 |
counter = counter + 5; // 4-byte integer + tag-field
|
|
2554 |
}
|
|
2555 |
break;
|
|
2556 |
|
|
2557 |
case CPhoneBookBuffer::EPhBkTypeDes16:
|
|
2558 |
{
|
|
2559 |
pbBuffer->GetValue(field);
|
|
2560 |
counter = counter + field.Length() + 3; // add desc length + length-field + tag-field
|
|
2561 |
if(aTagValue == RMobilePhoneBookStore::ETagPBText)
|
|
2562 |
{
|
|
2563 |
text.Set(field);
|
|
2564 |
}
|
|
2565 |
else if(aTagValue == RMobilePhoneBookStore::ETagPBNumber)
|
|
2566 |
{
|
|
2567 |
number.Set(field);
|
|
2568 |
}
|
|
2569 |
}
|
|
2570 |
break;
|
|
2571 |
|
|
2572 |
default:
|
|
2573 |
break;
|
|
2574 |
} // end switch aDataType
|
|
2575 |
|
|
2576 |
} // end while
|
|
2577 |
|
|
2578 |
|
|
2579 |
// TESTL(TInt(type)==RMobilePhone::ENationalNumber);
|
|
2580 |
TESTL(number.Compare(entryNumber)==KErrNone);
|
|
2581 |
TESTL(text.Compare(entryName)==KErrNone);
|
|
2582 |
TESTL(index == i ) ;
|
|
2583 |
} // end for
|
|
2584 |
|
|
2585 |
// Try to read below the phonebook limits
|
|
2586 |
requestedIndex = i-1;
|
|
2587 |
simPhBk.Read(aStatus, requestedIndex, numOfEntries, pbReadEmpty);
|
|
2588 |
User::WaitForRequest(aStatus);
|
|
2589 |
#ifndef SIM_TSY
|
|
2590 |
TESTL(aStatus==KErrNotFound || aStatus==KErrGeneral); // this entry should be empty
|
|
2591 |
#endif
|
|
2592 |
// Read by index, uses the Read() method
|
|
2593 |
for(i=1; i<=size; ++i)
|
|
2594 |
{
|
|
2595 |
//first reset the following three local buffers to delete any existing data
|
|
2596 |
entryNumber.FillZ();
|
|
2597 |
entryNumber.Zero();
|
|
2598 |
entryName.FillZ();
|
|
2599 |
entryName.Zero();
|
|
2600 |
pbData.FillZ();
|
|
2601 |
pbData.Zero();
|
|
2602 |
|
|
2603 |
requestedIndex = i;
|
|
2604 |
simPhBk.Read(aStatus, requestedIndex, numOfEntries, pbReadData1);
|
|
2605 |
User::WaitForRequest(aStatus);
|
|
2606 |
//TEST_CHECKL(aStatus.Int(), KErrNone, _L("GT83-TPHBK-006.00")) ;
|
|
2607 |
CHECKPOINT(ret, KErrNone, MakeCheckPointName(6, aMinorNum)) ;
|
|
2608 |
|
|
2609 |
entryNumber=numbers[i-1];
|
|
2610 |
entryName=names[i-1];
|
|
2611 |
|
|
2612 |
// reset all loop variables
|
|
2613 |
index = 0;
|
|
2614 |
counter = 0;
|
|
2615 |
aTagValue = 0;
|
|
2616 |
|
|
2617 |
// now decode PB data received in TLV format
|
|
2618 |
pbBuffer->Set(&pbReadData1); // Set pbBuffer to point to received phonebook data
|
|
2619 |
pbBuffer->StartRead(); // Start reading received phonebook data
|
|
2620 |
while(counter < pbReadData1.Length())
|
|
2621 |
{
|
|
2622 |
TInt ret = pbBuffer->GetTagAndType(aTagValue, aDataType);
|
|
2623 |
if(ret==KErrNotFound) // Reached the end of phonebook data
|
|
2624 |
break;
|
|
2625 |
TESTL(ret == KErrNone) ;
|
|
2626 |
switch(aDataType)
|
|
2627 |
{
|
|
2628 |
case CPhoneBookBuffer::EPhBkTypeInt8:
|
|
2629 |
{
|
|
2630 |
TUint8 int8(0);
|
|
2631 |
counter = counter + 1; // add tag-field only in case that is beginning of new field
|
|
2632 |
if(aTagValue == RMobilePhoneBookStore::ETagPBAdnIndex)
|
|
2633 |
{
|
|
2634 |
pbBuffer->GetValue(int8); //
|
|
2635 |
counter = counter + 1; // 1-byte integer
|
|
2636 |
index = int8;
|
|
2637 |
}
|
|
2638 |
}
|
|
2639 |
break;
|
|
2640 |
|
|
2641 |
case CPhoneBookBuffer::EPhBkTypeInt16:
|
|
2642 |
{
|
|
2643 |
TUint16 int16(0);
|
|
2644 |
pbBuffer->GetValue(int16);
|
|
2645 |
counter = counter + 3; // 2-byte integer + tag-field
|
|
2646 |
}
|
|
2647 |
break;
|
|
2648 |
|
|
2649 |
case CPhoneBookBuffer::EPhBkTypeInt32:
|
|
2650 |
{
|
|
2651 |
TUint32 int32(0);
|
|
2652 |
pbBuffer->GetValue(int32);
|
|
2653 |
counter = counter + 5; // 4-byte integer + tag-field
|
|
2654 |
}
|
|
2655 |
break;
|
|
2656 |
|
|
2657 |
case CPhoneBookBuffer::EPhBkTypeDes16:
|
|
2658 |
{
|
|
2659 |
pbBuffer->GetValue(field);
|
|
2660 |
counter = counter + field.Length() + 3; // add desc length + length-field + tag-field
|
|
2661 |
if(aTagValue == RMobilePhoneBookStore::ETagPBText)
|
|
2662 |
{
|
|
2663 |
text.Set(field);
|
|
2664 |
}
|
|
2665 |
else if(aTagValue == RMobilePhoneBookStore::ETagPBNumber)
|
|
2666 |
{
|
|
2667 |
number.Set(field);
|
|
2668 |
}
|
|
2669 |
}
|
|
2670 |
break;
|
|
2671 |
|
|
2672 |
default:
|
|
2673 |
break;
|
|
2674 |
} // end switch aDataType
|
|
2675 |
|
|
2676 |
} // end while
|
|
2677 |
|
|
2678 |
|
|
2679 |
// TESTL(TInt(type)==RMobilePhone::ENationalNumber);
|
|
2680 |
TESTL(number.Compare(entryNumber)==KErrNone);
|
|
2681 |
TESTL(text.Compare(entryName)==KErrNone);
|
|
2682 |
TESTL(index == i) ;
|
|
2683 |
}
|
|
2684 |
} //Is posible to read this ph/book?
|
|
2685 |
else
|
|
2686 |
{
|
|
2687 |
INFO_PRINTF2(_L("Read operation for %S phone book is not supporded!"), &aPhoneBookName) ;
|
|
2688 |
}
|
|
2689 |
simPhBk.Close();
|
|
2690 |
|
|
2691 |
delete pbBuffer;
|
|
2692 |
}
|
|
2693 |
|