|
1 /* |
|
2 * Copyright (c) 2002 - 2007 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: parsered informantion to display for STIF test |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // [INCLUDE FILES] - do not remove |
|
21 #include <e32svr.h> |
|
22 #include <StifParser.h> |
|
23 #include <Stiftestinterface.h> |
|
24 #include "MetaDataDisplay.h" |
|
25 #include <mmfFormatImplementationUIDs.hrh> |
|
26 |
|
27 #include <utf.h>//added on 17,12,2008 |
|
28 class CnvUtfConverter; |
|
29 |
|
30 |
|
31 // EXTERNAL DATA STRUCTURES |
|
32 //extern ?external_data; |
|
33 |
|
34 // EXTERNAL FUNCTION PROTOTYPES |
|
35 //extern ?external_function( ?arg_type,?arg_type ); |
|
36 |
|
37 // CONSTANTS |
|
38 //const ?type ?constant_var = ?constant; |
|
39 |
|
40 // MACROS |
|
41 //#define ?macro ?macro_def |
|
42 |
|
43 // LOCAL CONSTANTS AND MACROS |
|
44 //const ?type ?constant_var = ?constant; |
|
45 //#define ?macro_name ?macro_def |
|
46 |
|
47 // MODULE DATA STRUCTURES |
|
48 //enum ?declaration |
|
49 //typedef ?declaration |
|
50 |
|
51 // LOCAL FUNCTION PROTOTYPES |
|
52 //?type ?function_name( ?arg_type, ?arg_type ); |
|
53 |
|
54 // FORWARD DECLARATIONS |
|
55 //class ?FORWARD_CLASSNAME; |
|
56 |
|
57 // ============================= LOCAL FUNCTIONS =============================== |
|
58 |
|
59 // ----------------------------------------------------------------------------- |
|
60 // ?function_name ?description. |
|
61 // ?description |
|
62 // Returns: ?value_1: ?description |
|
63 // ?value_n: ?description_line1 |
|
64 // ?description_line2 |
|
65 // ----------------------------------------------------------------------------- |
|
66 // |
|
67 /* |
|
68 ?type ?function_name( |
|
69 ?arg_type arg, // ?description |
|
70 ?arg_type arg) // ?description |
|
71 { |
|
72 |
|
73 ?code // ?comment |
|
74 |
|
75 // ?comment |
|
76 ?code |
|
77 } |
|
78 */ |
|
79 |
|
80 // ============================ MEMBER FUNCTIONS =============================== |
|
81 |
|
82 // ----------------------------------------------------------------------------- |
|
83 // CMetaDataDisplay::Delete |
|
84 // Delete here all resources allocated and opened from test methods. |
|
85 // Called from destructor. |
|
86 // ----------------------------------------------------------------------------- |
|
87 // |
|
88 void CMetaDataDisplay::Delete() |
|
89 { |
|
90 |
|
91 } |
|
92 |
|
93 // ----------------------------------------------------------------------------- |
|
94 // CMetaDataDisplay::RunMethodL |
|
95 // Run specified method. Contains also table of test mothods and their names. |
|
96 // ----------------------------------------------------------------------------- |
|
97 // |
|
98 TInt CMetaDataDisplay::RunMethodL( |
|
99 CStifItemParser& aItem ) |
|
100 { |
|
101 |
|
102 static TStifFunctionInfo const KFunctions[] = |
|
103 { |
|
104 // Copy this line for every implemented function. |
|
105 // First string is the function name used in TestScripter script file. |
|
106 // Second is the actual implementation member function. |
|
107 //ADD NEW ENTRY HERE |
|
108 // [test cases entries] - Do not remove |
|
109 // Add test case for the header "MetaDataUtility.h" |
|
110 ENTRY( "TestCreateUtility", CMetaDataDisplay::TestCreateUtility ), |
|
111 ENTRY( "TestDeleteUtility", CMetaDataDisplay::TestDeleteUtility ), |
|
112 ENTRY( "TestOpenFile", CMetaDataDisplay::TestOpenFile ), |
|
113 ENTRY( "TestOpenFileWithFieldL", CMetaDataDisplay::TestOpenFileWithFieldL ), |
|
114 ENTRY( "TestOpenRFile", CMetaDataDisplay::TestOpenRFile ), |
|
115 ENTRY( "TestOpenRFileWithFieldL", CMetaDataDisplay::TestOpenRFileWithFieldL ), |
|
116 ENTRY( "TestOpenDesL", CMetaDataDisplay::TestOpenDesL ), |
|
117 ENTRY( "TestOpenDesWithFieldL", CMetaDataDisplay::TestOpenDesWithFieldL ), |
|
118 ENTRY( "TestMetaDataCountL", CMetaDataDisplay::TestMetaDataCountL ), |
|
119 ENTRY( "TestMetaDataFieldsL", CMetaDataDisplay::TestMetaDataFieldsL ), |
|
120 ENTRY( "TestOpenDesLWith3paras", CMetaDataDisplay::TestOpenDesLWith3paras ), |
|
121 ENTRY( "TestOpenDesLWith2paras", CMetaDataDisplay::TestOpenDesLWith2paras ), |
|
122 ENTRY( "TestOpenFileLWith3paras", CMetaDataDisplay::TestOpenFileLWith3paras ), |
|
123 ENTRY( "TestOpenFileLWith2paras", CMetaDataDisplay::TestOpenFileLWith2paras ), |
|
124 ENTRY( "TestOpenFileLFNFeildsMime", CMetaDataDisplay::TestOpenFileLFNFeildsMime ), |
|
125 ENTRY( "TestOpenFileLFNMime", CMetaDataDisplay::TestOpenFileLFNMime ), |
|
126 ENTRY( "TestID3Version", CMetaDataDisplay::TestID3Version ), |
|
127 ENTRY( "TestResetL", CMetaDataDisplay::TestResetL ), |
|
128 ENTRY( "TestInitChunkData", CMetaDataDisplay::TestInitChunkData ), |
|
129 ENTRY( "TestProcessChunkData", CMetaDataDisplay::TestProcessChunkData ), |
|
130 ENTRY( "TestIsNotChunkDataMode", CMetaDataDisplay::TestIsNotChunkDataMode ), |
|
131 ENTRY( "TestIsChunkDataMode", CMetaDataDisplay::TestIsChunkDataMode ), |
|
132 ENTRY( "TestCloseChunkData", CMetaDataDisplay::TestCloseChunkData ), |
|
133 ENTRY( "CreateChunkDataTester", CMetaDataDisplay::CreateChunkDataTester ), |
|
134 ENTRY( "DestructChunkDataTester", CMetaDataDisplay::DestructChunkDataTester ), |
|
135 |
|
136 /*---------------------------------------------------------------------- |
|
137 * Test functions for CMetaDataFieldContainer |
|
138 *---------------------------------------------------------------------- |
|
139 */ |
|
140 ENTRY( "GetContainerViaMetaDataUtility", CMetaDataDisplay::GetContainerViaMetaDataUtility ), |
|
141 ENTRY( "ContainerCount", CMetaDataDisplay::ContainerCount ), |
|
142 ENTRY( "ContainerField", CMetaDataDisplay::ContainerField ), |
|
143 ENTRY( "ContainerField8", CMetaDataDisplay::ContainerField8 ), |
|
144 ENTRY( "ContainerAppendLTDesCL", CMetaDataDisplay::ContainerAppendLTDesCL ), |
|
145 ENTRY( "ContainerAppendLTDesC8L", CMetaDataDisplay::ContainerAppendLTDesC8L ), |
|
146 ENTRY( "ContainerAt", CMetaDataDisplay::ContainerAt ), |
|
147 ENTRY( "ContainerFieldIdAt", CMetaDataDisplay::ContainerFieldIdAt ), |
|
148 }; |
|
149 |
|
150 const TInt count = sizeof( KFunctions ) / |
|
151 sizeof( TStifFunctionInfo ); |
|
152 |
|
153 return RunInternalL( KFunctions, count, aItem ); |
|
154 |
|
155 } |
|
156 |
|
157 |
|
158 // test MetaDataFieldsL test method function |
|
159 TInt CMetaDataDisplay::DisplayFields(TInt aEntryCount, CMetaDataUtility* iMetaData, TBool aDisplay) |
|
160 { |
|
161 TInt i; |
|
162 TInt j=0; |
|
163 |
|
164 for( i = 0; i < aEntryCount; i++) |
|
165 { |
|
166 TMetaDataFieldId fieldId; |
|
167 TPtrC field = iMetaData->MetaDataFieldsL().At(i, fieldId); |
|
168 |
|
169 if(field != KNullDesC) |
|
170 { |
|
171 // in case file has duplicate field ID |
|
172 if (iMetaDataField[fieldId]) |
|
173 delete iMetaDataField[fieldId]; |
|
174 |
|
175 iMetaDataField[fieldId] = field.AllocL(); |
|
176 if (aDisplay) |
|
177 { |
|
178 TBuf<50> fieldName = iMetaDataFieldName[fieldId]; |
|
179 fieldName.Append(_L("...")); |
|
180 iLog->Log(fieldName); |
|
181 // check for jpeg image |
|
182 if (fieldId == EMetaDataJpeg) |
|
183 iLog->Log(_L("(image)")); |
|
184 else |
|
185 iLog->Log(*iMetaDataField[fieldId]); |
|
186 } |
|
187 j++; |
|
188 } // end of if(field != KNullDesC) |
|
189 } // end of for |
|
190 |
|
191 if (j==aEntryCount) |
|
192 return KErrNone; |
|
193 else |
|
194 return KErrExpectedValueDifferent; |
|
195 |
|
196 } |
|
197 |
|
198 |
|
199 // Clear metadata fields |
|
200 void CMetaDataDisplay::DeleteMetaDataFields() |
|
201 { |
|
202 for (TInt i=0; i < KNumMetaDataField; i++) |
|
203 if (iMetaDataField[i]) |
|
204 { |
|
205 delete iMetaDataField[i]; |
|
206 iMetaDataField[i] = NULL; |
|
207 } |
|
208 } |
|
209 |
|
210 // ----------------------------------------------------------------------------- |
|
211 // CMetaDataDisplay::TestCreateUtility |
|
212 // NewL test method function. |
|
213 // (other items were commented in a header). |
|
214 // ----------------------------------------------------------------------------- |
|
215 // |
|
216 TInt CMetaDataDisplay::TestCreateUtility( CStifItemParser& /*aItem*/ ) |
|
217 { |
|
218 iLog->Log(_L("CMetaDataDisplay::TestCreateUtility")); |
|
219 TInt err = KErrNone; |
|
220 TRAP(err, iMetaData = CMetaDataUtility::NewL()); |
|
221 if ( err != KErrNone ) |
|
222 { |
|
223 iLog->Log(_L("CMetaDataDisplay::TestCreateUtility returned: %d"), err); |
|
224 } |
|
225 else |
|
226 { |
|
227 iLog->Log(_L("CMetaDataDisplay::TestCreateUtility returned no error")); |
|
228 } |
|
229 return err; |
|
230 } |
|
231 |
|
232 // ----------------------------------------------------------------------------- |
|
233 // CMetaDataDisplay::TestDeleteUtility |
|
234 // (other items were commented in a header). |
|
235 // ----------------------------------------------------------------------------- |
|
236 TInt CMetaDataDisplay::TestDeleteUtility(CStifItemParser& /*aItem*/ ) |
|
237 { |
|
238 TInt err = KErrNone; |
|
239 delete iMetaData; |
|
240 iMetaData = NULL; |
|
241 iLog->Log(_L("CMetaDataDisplay::TestDeleteUtility testing ~CMetaDataUtility end err=%d"), err); |
|
242 return err; |
|
243 } |
|
244 |
|
245 // ----------------------------------------------------------------------------- |
|
246 // CMetaDataDisplay::TestOpenFile |
|
247 // OpenFileL test method function. |
|
248 // (other items were commented in a header). |
|
249 // ----------------------------------------------------------------------------- |
|
250 // |
|
251 TInt CMetaDataDisplay::TestOpenFile( CStifItemParser& aItem ) |
|
252 { |
|
253 TInt err = KErrNone; |
|
254 TPtrC FileNamePtr; |
|
255 if ( aItem.GetNextString( FileNamePtr ) == KErrNone ) |
|
256 { |
|
257 TBuf<120> KFrom; |
|
258 KFrom.Append(KMetaDataDisplay_testPath); |
|
259 KFrom.Append(FileNamePtr); |
|
260 TFileName FileName = KFrom; |
|
261 iLog->Log(_L("Input file [%S]"), &FileNamePtr); |
|
262 |
|
263 TRAP(err, iMetaData->OpenFileL(FileName)); |
|
264 |
|
265 if ( err != KErrNone ) |
|
266 { |
|
267 iLog->Log(_L("CMetaDataDisplay::TestOpenFile returned: %d"), err); |
|
268 } |
|
269 else |
|
270 { |
|
271 iLog->Log(_L("CMetaDataDisplay::TestOpenFile returned no error")); |
|
272 } |
|
273 } |
|
274 return err; |
|
275 } |
|
276 |
|
277 // ----------------------------------------------------------------------------- |
|
278 // CMetaDataDisplay::TestOpenFileWithFieldL |
|
279 // OpenFileL test method function. |
|
280 // (other items were commented in a header). |
|
281 // ----------------------------------------------------------------------------- |
|
282 // |
|
283 TInt CMetaDataDisplay::TestOpenFileWithFieldL( CStifItemParser& aItem ) |
|
284 { |
|
285 TInt err = KErrNone; |
|
286 TPtrC FileNamePtr; |
|
287 RArray<TMetaDataFieldId> aWantedFields; |
|
288 TInt wantedField; |
|
289 if ( aItem.GetNextString( FileNamePtr ) == KErrNone ) |
|
290 { |
|
291 TBuf<120> KFrom; |
|
292 KFrom.Append(KMetaDataDisplay_testPath); |
|
293 KFrom.Append(FileNamePtr); |
|
294 TFileName FileName = KFrom; |
|
295 iLog->Log(_L("Input file [%S]"), &FileNamePtr); |
|
296 while( aItem.GetNextInt( wantedField ) == KErrNone ) |
|
297 { |
|
298 aWantedFields.Append(iMetaDataFieldID[wantedField]); |
|
299 } |
|
300 TRAP(err, iMetaData->OpenFileL( FileName, aWantedFields )); |
|
301 aWantedFields.Close(); |
|
302 if ( err != KErrNone ) |
|
303 { |
|
304 iLog->Log(_L("CMetaDataDisplay::TestOpenFileWithFieldL returned: %d"), err); |
|
305 } |
|
306 else |
|
307 { |
|
308 iLog->Log(_L("CMetaDataDisplay::TestOpenFileWithFieldL returned no error")); |
|
309 } |
|
310 } |
|
311 |
|
312 return err; |
|
313 } |
|
314 |
|
315 // ----------------------------------------------------------------------------- |
|
316 // CMetaDataDisplay::TestOpenRFile |
|
317 // OpenFileL test method function. |
|
318 // (other items were commented in a header). |
|
319 // ----------------------------------------------------------------------------- |
|
320 // |
|
321 TInt CMetaDataDisplay::TestOpenRFile( CStifItemParser& aItem ) |
|
322 { |
|
323 TInt err = KErrNone; |
|
324 TPtrC FileNamePtr; |
|
325 if ( aItem.GetNextString( FileNamePtr ) == KErrNone ) |
|
326 { |
|
327 TBuf<120> KFrom; |
|
328 KFrom.Append(KMetaDataDisplay_testPath); |
|
329 KFrom.Append(FileNamePtr); |
|
330 TFileName FileName = KFrom; |
|
331 iLog->Log(_L("Input file [%S]"), &FileNamePtr); |
|
332 RFs fs; |
|
333 RFile file; |
|
334 User::LeaveIfError(fs.Connect()); |
|
335 fs.ShareProtected(); |
|
336 User::LeaveIfError(file.Open( fs, FileName, EFileRead)); |
|
337 TRAP(err, iMetaData->OpenFileL(file)); |
|
338 fs.Close(); |
|
339 if ( err != KErrNone ) |
|
340 { |
|
341 iLog->Log(_L("CMetaDataDisplay::TestOpenRFile returned: %d"), err); |
|
342 } |
|
343 else |
|
344 { |
|
345 iLog->Log(_L("CMetaDataDisplay::TestOpenRFile returned no error")); |
|
346 } |
|
347 } |
|
348 return err; |
|
349 } |
|
350 |
|
351 // ----------------------------------------------------------------------------- |
|
352 // CMetaDataDisplay::TestOpenRFileWithFieldL |
|
353 // OpenFileL test method function. |
|
354 // (other items were commented in a header). |
|
355 // ----------------------------------------------------------------------------- |
|
356 // |
|
357 TInt CMetaDataDisplay::TestOpenRFileWithFieldL( CStifItemParser& aItem ) |
|
358 { |
|
359 TInt err = KErrNone; |
|
360 TPtrC FileNamePtr; |
|
361 RArray<TMetaDataFieldId> aWantedFields; |
|
362 TInt wantedField; |
|
363 |
|
364 if ( aItem.GetNextString( FileNamePtr ) == KErrNone ) |
|
365 { |
|
366 TBuf<120> KFrom; |
|
367 KFrom.Append(KMetaDataDisplay_testPath); |
|
368 KFrom.Append(FileNamePtr); |
|
369 TFileName FileName = KFrom; |
|
370 iLog->Log(_L("Input file [%S]"), &FileNamePtr); |
|
371 RFs fs; |
|
372 RFile file; |
|
373 User::LeaveIfError(fs.Connect()); |
|
374 fs.ShareProtected(); |
|
375 User::LeaveIfError(file.Open( fs, FileName, EFileRead)); |
|
376 while( aItem.GetNextInt( wantedField ) == KErrNone ) |
|
377 { |
|
378 aWantedFields.Append(iMetaDataFieldID[wantedField]); |
|
379 } |
|
380 TRAP(err, iMetaData->OpenFileL( file, aWantedFields )); |
|
381 fs.Close(); |
|
382 aWantedFields.Close(); |
|
383 if ( err != KErrNone ) |
|
384 { |
|
385 iLog->Log(_L("CMetaDataDisplay::TestOpenRFileWithFieldL returned: %d"), err); |
|
386 } |
|
387 else |
|
388 { |
|
389 iLog->Log(_L("CMetaDataDisplay::TestOpenRFileWithFieldL returned no error")); |
|
390 } |
|
391 } |
|
392 return err; |
|
393 } |
|
394 |
|
395 // ----------------------------------------------------------------------------- |
|
396 // CMetaDataDisplay::TestOpenDesL |
|
397 // OpenDesL test method function. |
|
398 // (other items were commented in a header). |
|
399 // ----------------------------------------------------------------------------- |
|
400 // |
|
401 TInt CMetaDataDisplay::TestOpenDesL( CStifItemParser& aItem ) |
|
402 { |
|
403 TInt err = KErrNone; |
|
404 TPtrC FileNamePtr; |
|
405 |
|
406 if ( aItem.GetNextString( FileNamePtr ) == KErrNone ) |
|
407 { |
|
408 TBuf<120> KFrom; |
|
409 KFrom.Append(KMetaDataDisplay_testPath); |
|
410 KFrom.Append(FileNamePtr); |
|
411 TFileName FileName = KFrom; |
|
412 iLog->Log(_L("Input file [%S]"), &FileNamePtr); |
|
413 |
|
414 TInt FileError, SoundSize=0; |
|
415 RFile file; |
|
416 RFs FsSession; |
|
417 iLog->Log(_L("Connecting to File Server Session") ); |
|
418 FileError = FsSession.Connect(); |
|
419 if (FileError) |
|
420 { |
|
421 iLog->Log(_L("File error FsSession.Connect() (%d)") , FileError); |
|
422 User::LeaveIfError(FileError); |
|
423 } |
|
424 |
|
425 iLog->Log(_L("Opening file to get size") ); |
|
426 FileError = file.Open(FsSession, FileName, EFileStream); |
|
427 if (FileError) |
|
428 { |
|
429 iLog->Log(_L("File error file.Open() (%d)") , FileError); |
|
430 User::LeaveIfError(FileError); |
|
431 } |
|
432 FileError = file.Size(SoundSize); |
|
433 iLog->Log(_L("File Size (%d)") , SoundSize); |
|
434 if (FileError) |
|
435 { |
|
436 iLog->Log(_L("Error getting size") ); |
|
437 User::LeaveIfError(FileError); |
|
438 } |
|
439 |
|
440 HBufC8 *SoundFile; |
|
441 SoundFile = HBufC8::NewLC(SoundSize); |
|
442 TPtr8 helper = SoundFile->Des(); |
|
443 helper.Append (KFrom); |
|
444 FileError = file.Read( helper ); |
|
445 if (FileError) |
|
446 { |
|
447 iLog->Log(_L("Error getting file Descriptor") ); |
|
448 User::LeaveIfError(FileError); |
|
449 } |
|
450 |
|
451 TRAP(err, iMetaData->OpenDesL(*SoundFile)); |
|
452 CleanupStack::PopAndDestroy(SoundFile); |
|
453 file.Close(); |
|
454 FsSession.Close(); |
|
455 if ( err != KErrNone ) |
|
456 { |
|
457 iLog->Log(_L("CMetaDataDisplay::TestOpenDesL returned: %d"), err); |
|
458 } |
|
459 else |
|
460 { |
|
461 iLog->Log(_L("CMetaDataDisplay::TestOpenDesL returned no error")); |
|
462 } |
|
463 } |
|
464 return err; |
|
465 } |
|
466 |
|
467 // ----------------------------------------------------------------------------- |
|
468 // CMetaDataDisplay::TestOpenDesWithFieldL |
|
469 // OpenDesL test method function. |
|
470 // (other items were commented in a header). |
|
471 // ----------------------------------------------------------------------------- |
|
472 // |
|
473 TInt CMetaDataDisplay::TestOpenDesWithFieldL( CStifItemParser& aItem ) |
|
474 { |
|
475 TInt err = KErrNone; |
|
476 TPtrC FileNamePtr; |
|
477 TInt wantedField; |
|
478 RArray<TMetaDataFieldId> aWantedFields; |
|
479 |
|
480 if ( aItem.GetNextString( FileNamePtr ) == KErrNone ) |
|
481 { |
|
482 TBuf<120> KFrom; |
|
483 KFrom.Append(KMetaDataDisplay_testPath); |
|
484 KFrom.Append(FileNamePtr); |
|
485 TFileName FileName = KFrom; |
|
486 iLog->Log(_L("Input file [%S]"), &FileNamePtr); |
|
487 TInt FileError, SoundSize=0; |
|
488 RFile file; |
|
489 RFs FsSession; |
|
490 iLog->Log(_L("Connecting to File Server Session") ); |
|
491 FileError = FsSession.Connect(); |
|
492 if (FileError) |
|
493 { |
|
494 iLog->Log(_L("File error FsSession.Connect() (%d)") , FileError); |
|
495 User::LeaveIfError(FileError); |
|
496 } |
|
497 |
|
498 iLog->Log(_L("Opening file to get size") ); |
|
499 FileError = file.Open(FsSession, FileName, EFileStream); |
|
500 if (FileError) |
|
501 { |
|
502 iLog->Log(_L("File error file.Open() (%d)") , FileError); |
|
503 User::LeaveIfError(FileError); |
|
504 } |
|
505 FileError = file.Size(SoundSize); |
|
506 iLog->Log(_L("File Size (%d)") , SoundSize); |
|
507 if (FileError) |
|
508 { |
|
509 iLog->Log(_L("Error getting size") ); |
|
510 User::LeaveIfError(FileError); |
|
511 } |
|
512 |
|
513 HBufC8 *SoundFile; |
|
514 SoundFile = HBufC8::NewLC(SoundSize); |
|
515 TPtr8 helper = SoundFile->Des(); |
|
516 helper.Append (KFrom); |
|
517 FileError = file.Read( helper ); |
|
518 if (FileError) |
|
519 { |
|
520 iLog->Log(_L("Error getting file Descriptor") ); |
|
521 User::LeaveIfError(FileError); |
|
522 } |
|
523 // Get aWantedFields |
|
524 while( aItem.GetNextInt( wantedField ) == KErrNone ) |
|
525 { |
|
526 aWantedFields.Append(iMetaDataFieldID[wantedField]); |
|
527 } |
|
528 TRAP(err, iMetaData->OpenDesL(*SoundFile, aWantedFields)); |
|
529 CleanupStack::PopAndDestroy(SoundFile); |
|
530 aWantedFields.Close(); |
|
531 file.Close(); |
|
532 FsSession.Close(); |
|
533 if ( err != KErrNone ) |
|
534 { |
|
535 iLog->Log(_L("CMetaDataDisplay::TestOpenDesL returned: %d"), err); |
|
536 } |
|
537 else |
|
538 { |
|
539 iLog->Log(_L("CMetaDataDisplay::TestOpenDesL returned no error")); |
|
540 } |
|
541 } |
|
542 return err; |
|
543 } |
|
544 |
|
545 |
|
546 // ----------------------------------------------------------------------------- |
|
547 // CMetaDataDisplay::TestMetaDataCountL |
|
548 // MetaDataCount test method function. |
|
549 // (other items were commented in a header). |
|
550 // ----------------------------------------------------------------------------- |
|
551 // |
|
552 TInt CMetaDataDisplay::TestMetaDataCountL(CStifItemParser& aItem ) |
|
553 { |
|
554 TInt err = KErrNone; |
|
555 TPtrC FileNamePtr; |
|
556 TInt count; |
|
557 if ( aItem.GetNextString( FileNamePtr ) == KErrNone ) |
|
558 { |
|
559 TBuf<120> KFrom; |
|
560 KFrom.Append(KMetaDataDisplay_testPath); |
|
561 KFrom.Append(FileNamePtr); |
|
562 TFileName FileName = KFrom; |
|
563 iLog->Log(_L("Input file [%S]"), &FileNamePtr); |
|
564 |
|
565 TRAP(err, iMetaData->OpenFileL(FileName)); |
|
566 if (!err) |
|
567 { |
|
568 count = iMetaData->MetaDataCount(); |
|
569 TInt expectedEntryCount; |
|
570 aItem.GetNextInt(expectedEntryCount); |
|
571 if ( count != expectedEntryCount ) |
|
572 { |
|
573 iLog->Log(_L("CMetaDataDisplay::TestMetaDataCountL returned: %d"), count); |
|
574 } |
|
575 else |
|
576 { |
|
577 iLog->Log(_L("CMetaDataDisplay::TestMetaDataCountL returned no error")); |
|
578 } |
|
579 } |
|
580 } |
|
581 return err; |
|
582 } |
|
583 |
|
584 // ----------------------------------------------------------------------------- |
|
585 // CMetaDataDisplay::TestMetaDataFieldsL |
|
586 // MetaDataFieldsL test method function. |
|
587 // (other items were commented in a header). |
|
588 // ----------------------------------------------------------------------------- |
|
589 // |
|
590 TInt CMetaDataDisplay::TestMetaDataFieldsL( CStifItemParser& aItem ) |
|
591 { |
|
592 TInt err = KErrNone; |
|
593 TPtrC FileNamePtr; |
|
594 TInt count; |
|
595 if ( aItem.GetNextString( FileNamePtr ) == KErrNone ) |
|
596 { |
|
597 TBuf<120> KFrom; |
|
598 KFrom.Append(KMetaDataDisplay_testPath); |
|
599 KFrom.Append(FileNamePtr); |
|
600 TFileName FileName = KFrom; |
|
601 iLog->Log(_L("Input file [%S]"), &FileNamePtr); |
|
602 |
|
603 TRAP(err, iMetaData->OpenFileL(FileName)); |
|
604 if (!err) |
|
605 { |
|
606 count = iMetaData->MetaDataCount(); |
|
607 TInt expectedEntryCount; |
|
608 aItem.GetNextInt(expectedEntryCount); |
|
609 if ( count == expectedEntryCount ) |
|
610 { |
|
611 TInt error = DisplayFields(count, iMetaData); |
|
612 DeleteMetaDataFields(); |
|
613 if (!error) |
|
614 { |
|
615 iLog->Log(_L("Test was successful")); |
|
616 } |
|
617 else |
|
618 { |
|
619 iLog->Log(_L("Display metadata fields error [%d]"), error); |
|
620 } |
|
621 iLog->Log(_L("CMetaDataDisplay::TestMetaDataFieldsL returned no error")); |
|
622 } |
|
623 else |
|
624 { |
|
625 iLog->Log(_L("CMetaDataDisplay::TestMetaDataFieldsL returned: %d"), err); |
|
626 |
|
627 } |
|
628 } |
|
629 } |
|
630 return err; |
|
631 } |
|
632 |
|
633 |
|
634 HBufC8* CMetaDataDisplay::TestGetDescriptor8LC(const TFileName& aFileName) |
|
635 { |
|
636 TInt FileError, SoundSize=0; |
|
637 RFile file; |
|
638 RFs FsSession; |
|
639 HBufC8 *SoundFileDes; |
|
640 |
|
641 iLog->Log(_L("Connecting to File Server Session") ); |
|
642 FileError = FsSession.Connect(); |
|
643 if (FileError) |
|
644 { |
|
645 iLog->Log(_L("File error FsSession.Connect() (%d)") , FileError); |
|
646 User::LeaveIfError(FileError); |
|
647 } |
|
648 |
|
649 iLog->Log(_L("Opening file to get size") ); |
|
650 FileError = file.Open(FsSession, aFileName, EFileStream); |
|
651 if (FileError) |
|
652 { |
|
653 iLog->Log(_L("File error file.Open() (%d)") , FileError); |
|
654 User::LeaveIfError(FileError); |
|
655 } |
|
656 FileError = file.Size(SoundSize); |
|
657 iLog->Log(_L("File Size (%d)") , SoundSize); |
|
658 if (FileError) |
|
659 { |
|
660 iLog->Log(_L("Error getting size") ); |
|
661 User::LeaveIfError(FileError); |
|
662 } |
|
663 |
|
664 // TPtr8 helper; |
|
665 |
|
666 SoundFileDes = HBufC8::NewLC(SoundSize); |
|
667 |
|
668 TPtr8 helper = SoundFileDes->Des(); |
|
669 FileError = file.Read( helper ); |
|
670 |
|
671 if (FileError) |
|
672 { |
|
673 iLog->Log(_L("Error getting file Descriptor") ); |
|
674 User::LeaveIfError(FileError); |
|
675 |
|
676 } |
|
677 |
|
678 iLog->Log(_L("Descriptor length [%d]") , SoundFileDes->Size() ); |
|
679 file.Close(); |
|
680 FsSession.Close(); |
|
681 return SoundFileDes; |
|
682 } |
|
683 |
|
684 HBufC8* CMetaDataDisplay::GetDescriptor8LC( const TFileName& aFileName,TBool aIsMimeUsed,TInt aSize ) |
|
685 { |
|
686 TInt FileError, SoundSize = aSize; |
|
687 HBufC8 *SoundFile; |
|
688 RFile file; |
|
689 RFs FsSession; |
|
690 if( SoundSize == 0 ) |
|
691 { |
|
692 iLog->Log(_L("Connecting to File Server Session") ); |
|
693 FileError = FsSession.Connect(); |
|
694 if (FileError) |
|
695 { |
|
696 iLog->Log(_L("File error FsSession.Connect() (%d)") , FileError); |
|
697 User::LeaveIfError(FileError); |
|
698 } |
|
699 |
|
700 iLog->Log(_L("Opening file to get size") ); |
|
701 FileError = file.Open(FsSession, aFileName, EFileStream); |
|
702 if (FileError) |
|
703 { |
|
704 iLog->Log(_L("File error file.Open() (%d)") , FileError); |
|
705 User::LeaveIfError(FileError); |
|
706 } |
|
707 FileError = file.Size(SoundSize); |
|
708 iLog->Log(_L("File Size (%d)") , SoundSize); |
|
709 if (FileError) |
|
710 { |
|
711 iLog->Log(_L("Error getting size") ); |
|
712 User::LeaveIfError(FileError); |
|
713 } |
|
714 file.Close(); |
|
715 FsSession.Close(); |
|
716 } |
|
717 // TPtr8 helper; |
|
718 if ( aIsMimeUsed ) |
|
719 { |
|
720 _LIT(MP3MIME,"audio/mpeg"); |
|
721 SoundFile = HBufC8::NewLC( SoundSize ); |
|
722 |
|
723 TPtr8 helper(SoundFile->Des()); |
|
724 helper.Append(MP3MIME); |
|
725 } |
|
726 else |
|
727 { |
|
728 SoundFile = HBufC8::NewLC(SoundSize); |
|
729 TPtr8 helper = SoundFile->Des(); |
|
730 FileError = file.Read( helper ); |
|
731 if (FileError) |
|
732 { |
|
733 iLog->Log(_L("Error getting file Descriptor") ); |
|
734 User::LeaveIfError(FileError); |
|
735 } |
|
736 iLog->Log(_L("Descriptor length [%d]") , SoundFile->Size() ); |
|
737 } |
|
738 return SoundFile; |
|
739 } |
|
740 |
|
741 void CMetaDataDisplay::CheckID3Version() |
|
742 { |
|
743 iLog->Log( _L("Checking ID3 version.") ); |
|
744 TID3Version ID3Version = iMetaData->ID3Version(); |
|
745 switch( ID3Version ) |
|
746 { |
|
747 case ENonID3: |
|
748 iLog->Log( _L("ID3 version is ENonID3.") ); |
|
749 break; |
|
750 case EID3Version1: |
|
751 iLog->Log( _L("ID3 version is EID3Version1.") ); |
|
752 break; |
|
753 case EID3Version2: |
|
754 iLog->Log( _L("ID3 version is EID3Version2.") ); |
|
755 break; |
|
756 } |
|
757 iLog->Log( _L("Checking ID3 version end.") ); |
|
758 } |
|
759 |
|
760 |
|
761 // ----------------------------------------------------------------------------- |
|
762 // CMetaDataDisplay::TestOpenDesLWith3paras |
|
763 // TestOpenDesLWith3paras test method function. |
|
764 // (other items were commented in a header). |
|
765 // ----------------------------------------------------------------------------- |
|
766 // |
|
767 TInt CMetaDataDisplay::TestOpenDesLWith3paras(CStifItemParser& aItem ) |
|
768 { |
|
769 iLog->Log( _L("Entering TestOpenDesLWith3paras.") ); |
|
770 TInt err = KErrNone; |
|
771 TPtrC FileNamePtr; |
|
772 TInt isMimeUsed; |
|
773 RArray<TMetaDataFieldId> aWantedFields; |
|
774 TInt wantedField; |
|
775 HBufC8 *SoundFile; |
|
776 HBufC8 *SoundFileDes; |
|
777 if ( aItem.GetNextString( FileNamePtr ) == KErrNone ) |
|
778 { |
|
779 TBuf<120> KFrom; |
|
780 KFrom.Append(KMetaDataDisplay_testPath); |
|
781 KFrom.Append(FileNamePtr); |
|
782 TFileName FileName = KFrom; |
|
783 |
|
784 iLog->Log( _L("Input file [%S]"), &FileNamePtr ); |
|
785 SoundFileDes = TestGetDescriptor8LC( FileName ); |
|
786 if( ( err = aItem.GetNextInt( isMimeUsed ) ) == KErrNone ) |
|
787 { |
|
788 if( isMimeUsed ) |
|
789 { |
|
790 SoundFile = GetDescriptor8LC( FileName,ETrue ); |
|
791 } |
|
792 else |
|
793 { |
|
794 SoundFile = GetDescriptor8LC( FileName,EFalse ); |
|
795 } |
|
796 } |
|
797 else |
|
798 { |
|
799 iLog->Log( _L("Bad parameter is passed in.") ); |
|
800 User::Leave( err ); |
|
801 } |
|
802 |
|
803 while( !aItem.GetNextInt( wantedField ) ) |
|
804 { |
|
805 aWantedFields.Append( iMetaDataFieldID[wantedField] ); |
|
806 } |
|
807 if( SoundFileDes && SoundFile ) |
|
808 { |
|
809 //iMetaData->OpenDesL( *SoundFileDes,aWantedFields,*SoundFile ); |
|
810 TRAP( err, iMetaData->OpenDesL( *SoundFileDes,aWantedFields,*SoundFile ) ); |
|
811 } |
|
812 else |
|
813 { |
|
814 err = KBadParameter; |
|
815 iLog->Log( _L("Pass in bad parameter(s): %d"), err ); |
|
816 User::Leave( err ); |
|
817 } |
|
818 if ( err != KErrNone ) |
|
819 { |
|
820 iLog->Log( _L("CMetaDataDisplay::TestOpenDesLWith3paras returned: %d"), err ); |
|
821 } |
|
822 else |
|
823 { |
|
824 iLog->Log( _L("CMetaDataDisplay::TestOpenDesLWith3paras returned no error") ); |
|
825 } |
|
826 CleanupStack::PopAndDestroy( 2 );//SoundFileDes first ,SoundFile second |
|
827 } |
|
828 iLog->Log( _L("End calling TestOpenDesLWith3paras.") ); |
|
829 return err; |
|
830 } |
|
831 // ----------------------------------------------------------------------------- |
|
832 // CMetaDataDisplay::TestOpenDesLWith2paras |
|
833 // TestOpenDesLWith2paras test method function. |
|
834 // (other items were commented in a header). |
|
835 // ----------------------------------------------------------------------------- |
|
836 // |
|
837 TInt CMetaDataDisplay::TestOpenDesLWith2paras(CStifItemParser& aItem ) |
|
838 { |
|
839 iLog->Log( _L("Entering TestOpenDesLWith2paras.") ); |
|
840 TInt err = KErrNone; |
|
841 TPtrC FileNamePtr; |
|
842 TInt isMimeUsed; |
|
843 HBufC8 *SoundFile; |
|
844 HBufC8 *SoundFileDes; |
|
845 if ( aItem.GetNextString( FileNamePtr ) == KErrNone ) |
|
846 { |
|
847 TBuf<120> KFrom; |
|
848 KFrom.Append(KMetaDataDisplay_testPath); |
|
849 KFrom.Append(FileNamePtr); |
|
850 TFileName FileName = KFrom; |
|
851 iLog->Log( _L("Input file [%S]"), &FileNamePtr ); |
|
852 SoundFileDes = TestGetDescriptor8LC( FileName ); |
|
853 if( ( err = aItem.GetNextInt( isMimeUsed ) ) == KErrNone ) |
|
854 { |
|
855 if( isMimeUsed ) |
|
856 { |
|
857 SoundFile = GetDescriptor8LC( FileName,ETrue ); |
|
858 } |
|
859 else |
|
860 { |
|
861 SoundFile = GetDescriptor8LC( FileName,EFalse ); |
|
862 } |
|
863 } |
|
864 else |
|
865 { |
|
866 iLog->Log( _L("Bad parameter is passed in.") ); |
|
867 User::Leave( err ); |
|
868 } |
|
869 |
|
870 if( SoundFileDes && SoundFile ) |
|
871 { |
|
872 //iMetaData->OpenDesL( *SoundFileDes,*SoundFile ); |
|
873 TRAP( err, iMetaData->OpenDesL( *SoundFileDes,*SoundFile ) ); |
|
874 } |
|
875 else |
|
876 { |
|
877 err = KBadParameter; |
|
878 iLog->Log( _L("Pass in bad parameter(s): %d"), err ); |
|
879 User::Leave( err ); |
|
880 } |
|
881 if ( err != KErrNone ) |
|
882 { |
|
883 iLog->Log( _L("CMetaDataDisplay::TestOpenDesLWith2paras returned: %d"), err ); |
|
884 } |
|
885 else |
|
886 { |
|
887 iLog->Log( _L("CMetaDataDisplay::TestOpenDesLWith2paras returned no error") ); |
|
888 } |
|
889 CleanupStack::PopAndDestroy( 2 );//SoundFileDes first ,SoundFile second |
|
890 } |
|
891 iLog->Log( _L("End calling TestOpenDesLWith2paras.") ); |
|
892 return err; |
|
893 } |
|
894 |
|
895 // ----------------------------------------------------------------------------- |
|
896 // CMetaDataDisplay::TestOpenFileLWith3paras |
|
897 // TestOpenFileLWith3paras test method function. |
|
898 // (other items were commented in a header). |
|
899 // ----------------------------------------------------------------------------- |
|
900 // |
|
901 TInt CMetaDataDisplay::TestOpenFileLWith3paras(CStifItemParser& aItem ) |
|
902 { |
|
903 iLog->Log( _L("Entering TestOpenFileLWith3paras.") ); |
|
904 TInt err = KErrNone; |
|
905 TPtrC FileNamePtr; |
|
906 TInt isMimeUsed; |
|
907 TInt isCheckID3Version( 0 ); |
|
908 RArray<TMetaDataFieldId> aWantedFields; |
|
909 TInt wantedField; |
|
910 HBufC8 *SoundFile; |
|
911 if ( aItem.GetNextString( FileNamePtr ) == KErrNone ) |
|
912 { |
|
913 TBuf<120> KFrom; |
|
914 KFrom.Append(KMetaDataDisplay_testPath); |
|
915 KFrom.Append(FileNamePtr); |
|
916 TFileName FileName = KFrom; |
|
917 iLog->Log( _L("Input file [%S]"), &FileNamePtr ); |
|
918 |
|
919 RFs fs; |
|
920 RFile file; |
|
921 User::LeaveIfError(fs.Connect()); |
|
922 fs.ShareProtected(); |
|
923 User::LeaveIfError(file.Open( fs, FileName, EFileRead)); |
|
924 TInt SoundSize; |
|
925 TInt FileError = file.Size(SoundSize); |
|
926 iLog->Log(_L("File Size (%d)") , SoundSize); |
|
927 if( FileError ) |
|
928 { |
|
929 iLog->Log( _L("Error getting size") ); |
|
930 User::LeaveIfError( FileError ); |
|
931 } |
|
932 if( ( err = aItem.GetNextInt( isMimeUsed ) ) == KErrNone ) |
|
933 { |
|
934 if( isMimeUsed ) |
|
935 { |
|
936 SoundFile = GetDescriptor8LC( FileName,ETrue,SoundSize ); |
|
937 } |
|
938 else |
|
939 { |
|
940 SoundFile = GetDescriptor8LC( FileName,EFalse,SoundSize ); |
|
941 } |
|
942 } |
|
943 else |
|
944 { |
|
945 iLog->Log( _L("Bad parameter is passed in.") ); |
|
946 User::Leave( err ); |
|
947 } |
|
948 |
|
949 aItem.GetNextInt( isCheckID3Version ); |
|
950 |
|
951 while( !aItem.GetNextInt( wantedField ) ) |
|
952 { |
|
953 aWantedFields.Append( iMetaDataFieldID[wantedField] ); |
|
954 } |
|
955 if( SoundFile ) |
|
956 { |
|
957 //iMetaData->OpenFileL( file,aWantedFields,*SoundFile ); |
|
958 TRAP( err, iMetaData->OpenFileL( file,aWantedFields,*SoundFile ) ); |
|
959 if( isCheckID3Version ) |
|
960 {//TInt isCheckID3Version( 0 ); |
|
961 CheckID3Version(); |
|
962 } |
|
963 } |
|
964 else |
|
965 { |
|
966 err = KBadParameter; |
|
967 iLog->Log( _L("Pass in bad parameter(s): %d"), err ); |
|
968 User::Leave( err ); |
|
969 } |
|
970 if ( err != KErrNone ) |
|
971 { |
|
972 iLog->Log( _L("CMetaDataDisplay::TestOpenFileLWith3paras returned: %d"), err ); |
|
973 } |
|
974 else |
|
975 { |
|
976 iLog->Log( _L("CMetaDataDisplay::TestOpenFileLWith3paras returned no error") ); |
|
977 } |
|
978 CleanupStack::PopAndDestroy( SoundFile ); |
|
979 file.Close(); |
|
980 fs.Close(); |
|
981 } |
|
982 iLog->Log( _L("End calling TestOpenFileLWith3paras.") ); |
|
983 return err; |
|
984 } |
|
985 // ----------------------------------------------------------------------------- |
|
986 // CMetaDataDisplay::TestOpenFileLWith2paras |
|
987 // TestOpenFileLWith2paras test method function. |
|
988 // (other items were commented in a header). |
|
989 // ----------------------------------------------------------------------------- |
|
990 // |
|
991 TInt CMetaDataDisplay::TestOpenFileLWith2paras(CStifItemParser& aItem ) |
|
992 { |
|
993 iLog->Log( _L("Entering TestOpenFileLWith2paras.") ); |
|
994 TInt err = KErrNone; |
|
995 TPtrC FileNamePtr; |
|
996 TInt isMimeUsed; |
|
997 TInt isCheckID3Version( 0 ); |
|
998 |
|
999 HBufC8 *SoundFile; |
|
1000 if ( aItem.GetNextString( FileNamePtr ) == KErrNone ) |
|
1001 { |
|
1002 TBuf<120> KFrom; |
|
1003 KFrom.Append(KMetaDataDisplay_testPath); |
|
1004 KFrom.Append(FileNamePtr); |
|
1005 TFileName FileName = KFrom; |
|
1006 iLog->Log( _L("Input file [%S]"), &FileNamePtr ); |
|
1007 |
|
1008 RFs fs; |
|
1009 RFile file; |
|
1010 User::LeaveIfError(fs.Connect()); |
|
1011 //fs.ShareProtected(); |
|
1012 User::LeaveIfError(file.Open( fs, FileName, EFileRead) ); |
|
1013 TInt SoundSize; |
|
1014 TInt FileError = file.Size(SoundSize); |
|
1015 iLog->Log(_L("File Size (%d)") , SoundSize); |
|
1016 if( FileError ) |
|
1017 { |
|
1018 iLog->Log( _L("Error getting size") ); |
|
1019 User::LeaveIfError( FileError ); |
|
1020 } |
|
1021 if( ( err = aItem.GetNextInt( isMimeUsed ) ) == KErrNone ) |
|
1022 { |
|
1023 if( isMimeUsed ) |
|
1024 { |
|
1025 SoundFile = GetDescriptor8LC( FileName,ETrue,SoundSize ); |
|
1026 } |
|
1027 else |
|
1028 { |
|
1029 SoundFile = GetDescriptor8LC( FileName,EFalse,SoundSize ); |
|
1030 } |
|
1031 } |
|
1032 else |
|
1033 { |
|
1034 iLog->Log( _L("Bad parameter is passed in.") ); |
|
1035 User::Leave( err ); |
|
1036 } |
|
1037 |
|
1038 aItem.GetNextInt( isCheckID3Version ); |
|
1039 |
|
1040 if( SoundFile ) |
|
1041 { |
|
1042 //iMetaData->OpenFileL( file,*SoundFile ); |
|
1043 TRAP( err, iMetaData->OpenFileL( file,*SoundFile ) ); |
|
1044 if( isCheckID3Version ) |
|
1045 {//TInt isCheckID3Version( 0 ); |
|
1046 CheckID3Version(); |
|
1047 } |
|
1048 } |
|
1049 else |
|
1050 { |
|
1051 err = KBadParameter; |
|
1052 iLog->Log( _L("Pass in bad parameter(s): %d"), err ); |
|
1053 User::Leave( err ); |
|
1054 } |
|
1055 if ( err != KErrNone ) |
|
1056 { |
|
1057 iLog->Log( _L("CMetaDataDisplay::TestOpenFileLWith2paras returned: %d"), err ); |
|
1058 } |
|
1059 else |
|
1060 { |
|
1061 iLog->Log( _L("CMetaDataDisplay::TestOpenFileLWith2paras returned no error") ); |
|
1062 } |
|
1063 CleanupStack::PopAndDestroy( SoundFile ); |
|
1064 file.Close(); |
|
1065 fs.Close(); |
|
1066 |
|
1067 } |
|
1068 iLog->Log( _L("End calling TestOpenFileLWith2paras.") ); |
|
1069 return err; |
|
1070 } |
|
1071 // ----------------------------------------------------------------------------- |
|
1072 // CMetaDataDisplay::TestOpenFileLFNFeildsMime |
|
1073 // TestOpenFileLFNFeildsMime test method function. |
|
1074 // (other items were commented in a header). |
|
1075 // ----------------------------------------------------------------------------- |
|
1076 // |
|
1077 TInt CMetaDataDisplay::TestOpenFileLFNFeildsMime(CStifItemParser& aItem ) |
|
1078 { |
|
1079 iLog->Log( _L("Entering TestOpenFileLFNFeildsMime.") ); |
|
1080 TInt err = KErrNone; |
|
1081 TPtrC FileNamePtr; |
|
1082 TInt isMimeUsed; |
|
1083 TInt isCheckID3Version( 0 ); |
|
1084 RArray<TMetaDataFieldId> aWantedFields; |
|
1085 TInt wantedField; |
|
1086 HBufC8 *SoundFile; |
|
1087 |
|
1088 if ( aItem.GetNextString( FileNamePtr ) == KErrNone ) |
|
1089 { |
|
1090 TBuf<120> KFrom; |
|
1091 KFrom.Append(KMetaDataDisplay_testPath); |
|
1092 KFrom.Append(FileNamePtr); |
|
1093 TFileName FileName = KFrom; |
|
1094 iLog->Log( _L("Input file [%S]"), &FileNamePtr ); |
|
1095 |
|
1096 if( ( err = aItem.GetNextInt( isMimeUsed ) ) == KErrNone ) |
|
1097 { |
|
1098 if( isMimeUsed ) |
|
1099 { |
|
1100 SoundFile = GetDescriptor8LC( FileName,ETrue ); |
|
1101 } |
|
1102 else |
|
1103 { |
|
1104 SoundFile = GetDescriptor8LC( FileName,EFalse ); |
|
1105 } |
|
1106 } |
|
1107 else |
|
1108 { |
|
1109 iLog->Log( _L("Bad parameter is passed in.") ); |
|
1110 User::Leave( err ); |
|
1111 } |
|
1112 |
|
1113 aItem.GetNextInt( isCheckID3Version ); |
|
1114 |
|
1115 while( !aItem.GetNextInt( wantedField ) ) |
|
1116 { |
|
1117 aWantedFields.Append( iMetaDataFieldID[wantedField] ); |
|
1118 } |
|
1119 if( SoundFile ) |
|
1120 { |
|
1121 //iMetaData->OpenFileL( FileName,aWantedFields,*SoundFile ); |
|
1122 TRAP( err, iMetaData->OpenFileL( FileName,aWantedFields,*SoundFile ) ); |
|
1123 if( isCheckID3Version ) |
|
1124 {//TInt isCheckID3Version( 0 ); |
|
1125 CheckID3Version(); |
|
1126 } |
|
1127 } |
|
1128 else |
|
1129 { |
|
1130 err = KBadParameter; |
|
1131 iLog->Log( _L("Pass in bad parameter(s): %d"), err ); |
|
1132 User::Leave( err ); |
|
1133 } |
|
1134 if ( err != KErrNone ) |
|
1135 { |
|
1136 iLog->Log( _L("CMetaDataDisplay::TestOpenFileLFNFeildsMime returned: %d"), err ); |
|
1137 } |
|
1138 else |
|
1139 { |
|
1140 iLog->Log( _L("CMetaDataDisplay::TestOpenFileLFNFeildsMime returned no error") ); |
|
1141 } |
|
1142 CleanupStack::PopAndDestroy( SoundFile );//SoundFile |
|
1143 } |
|
1144 iLog->Log( _L("End calling TestOpenFileLFNFeildsMime.") ); |
|
1145 return err; |
|
1146 } |
|
1147 // ----------------------------------------------------------------------------- |
|
1148 // CMetaDataDisplay::TestOpenFileLFNMime |
|
1149 // TestOpenFileLFNMime test method function. |
|
1150 // (other items were commented in a header). |
|
1151 // ----------------------------------------------------------------------------- |
|
1152 // |
|
1153 TInt CMetaDataDisplay::TestOpenFileLFNMime(CStifItemParser& aItem ) |
|
1154 { |
|
1155 iLog->Log( _L("Entering TestOpenFileLFNMime.") ); |
|
1156 TInt err = KErrNone; |
|
1157 TPtrC FileNamePtr; |
|
1158 TInt isMimeUsed; |
|
1159 TInt isCheckID3Version( 0 ); |
|
1160 HBufC8 *SoundFile; |
|
1161 |
|
1162 if ( aItem.GetNextString( FileNamePtr ) == KErrNone ) |
|
1163 { |
|
1164 TBuf<120> KFrom; |
|
1165 KFrom.Append(KMetaDataDisplay_testPath); |
|
1166 KFrom.Append(FileNamePtr); |
|
1167 TFileName FileName = KFrom; |
|
1168 iLog->Log( _L("Input file [%S]"), &FileNamePtr ); |
|
1169 |
|
1170 if( ( err = aItem.GetNextInt( isMimeUsed ) ) == KErrNone ) |
|
1171 { |
|
1172 if( isMimeUsed ) |
|
1173 { |
|
1174 SoundFile = GetDescriptor8LC( FileName,ETrue ); |
|
1175 } |
|
1176 else |
|
1177 { |
|
1178 SoundFile = GetDescriptor8LC( FileName,EFalse ); |
|
1179 } |
|
1180 } |
|
1181 else |
|
1182 { |
|
1183 iLog->Log( _L("Bad parameter is passed in.") ); |
|
1184 User::Leave( err ); |
|
1185 } |
|
1186 aItem.GetNextInt( isCheckID3Version ); |
|
1187 if( SoundFile ) |
|
1188 { |
|
1189 //iMetaData->OpenFileL( FileName,*SoundFile ); |
|
1190 TRAP( err, iMetaData->OpenFileL( FileName,*SoundFile ) ); |
|
1191 if( isCheckID3Version ) |
|
1192 {//TInt isCheckID3Version( 0 ); |
|
1193 CheckID3Version(); |
|
1194 } |
|
1195 } |
|
1196 else |
|
1197 { |
|
1198 err = KBadParameter; |
|
1199 iLog->Log( _L("Pass in bad parameter(s): %d"), err ); |
|
1200 User::Leave( err ); |
|
1201 } |
|
1202 if ( err != KErrNone ) |
|
1203 { |
|
1204 iLog->Log( _L("CMetaDataDisplay::TestOpenFileLFNMime returned: %d"), err ); |
|
1205 } |
|
1206 else |
|
1207 { |
|
1208 iLog->Log( _L("CMetaDataDisplay::TestOpenFileLFNMime returned no error") ); |
|
1209 } |
|
1210 CleanupStack::PopAndDestroy( SoundFile );//SoundFile |
|
1211 } |
|
1212 iLog->Log( _L("End calling TestOpenFileLFNMime.") ); |
|
1213 return err; |
|
1214 } |
|
1215 // ----------------------------------------------------------------------------- |
|
1216 // CMetaDataDisplay::TestID3Version |
|
1217 // TestID3Version test method function. |
|
1218 // (other items were commented in a header). |
|
1219 // ----------------------------------------------------------------------------- |
|
1220 // |
|
1221 TInt CMetaDataDisplay::TestID3Version(CStifItemParser& aItem ) |
|
1222 { |
|
1223 iLog->Log( _L("Entering TestID3Version.") ); |
|
1224 TInt err = KErrNone; |
|
1225 TPtrC FileNamePtr; |
|
1226 TInt isMimeUsed; |
|
1227 TInt isCheckID3Version( 0 ); |
|
1228 HBufC8 *SoundFile; |
|
1229 |
|
1230 if ( aItem.GetNextString( FileNamePtr ) == KErrNone ) |
|
1231 { |
|
1232 TBuf<120> KFrom; |
|
1233 KFrom.Append(KMetaDataDisplay_testPath); |
|
1234 KFrom.Append(FileNamePtr); |
|
1235 TFileName FileName = KFrom; |
|
1236 iLog->Log( _L("Input file [%S]"), &FileNamePtr ); |
|
1237 |
|
1238 if( ( err = aItem.GetNextInt( isMimeUsed ) ) == KErrNone ) |
|
1239 { |
|
1240 if( isMimeUsed ) |
|
1241 { |
|
1242 SoundFile = GetDescriptor8LC( FileName,ETrue ); |
|
1243 } |
|
1244 else |
|
1245 { |
|
1246 SoundFile = GetDescriptor8LC( FileName,EFalse ); |
|
1247 } |
|
1248 } |
|
1249 else |
|
1250 { |
|
1251 iLog->Log( _L("Bad parameter is passed in.") ); |
|
1252 User::Leave( err ); |
|
1253 } |
|
1254 aItem.GetNextInt( isCheckID3Version ); |
|
1255 if( SoundFile ) |
|
1256 { |
|
1257 iMetaData->OpenFileL( FileName,*SoundFile ); |
|
1258 if( isCheckID3Version ) |
|
1259 {//TInt isCheckID3Version( 0 ); |
|
1260 CheckID3Version(); |
|
1261 } |
|
1262 } |
|
1263 else |
|
1264 { |
|
1265 err = KBadParameter; |
|
1266 iLog->Log( _L("Pass in bad parameter(s): %d"), err ); |
|
1267 User::Leave( err ); |
|
1268 } |
|
1269 if ( err != KErrNone ) |
|
1270 { |
|
1271 iLog->Log( _L("CMetaDataDisplay::TestID3Version returned: %d"), err ); |
|
1272 } |
|
1273 else |
|
1274 { |
|
1275 iLog->Log( _L("CMetaDataDisplay::TestID3Version returned no error") ); |
|
1276 } |
|
1277 CleanupStack::PopAndDestroy( SoundFile );//SoundFile |
|
1278 } |
|
1279 iLog->Log( _L("End calling TestID3Version.") ); |
|
1280 return err; |
|
1281 } |
|
1282 |
|
1283 // ----------------------------------------------------------------------------- |
|
1284 // CMetaDataDisplay::TestResetL |
|
1285 // ResetL test method function. |
|
1286 // (other items were commented in a header). |
|
1287 // ----------------------------------------------------------------------------- |
|
1288 // |
|
1289 TInt CMetaDataDisplay::TestResetL(CStifItemParser& /*aItem*/ ) |
|
1290 { |
|
1291 iLog->Log( _L("Entering TestResetL.") ); |
|
1292 TInt err = KErrNone; |
|
1293 TRAP( err,iMetaData->ResetL() ); |
|
1294 if( err == KErrNone ) |
|
1295 { |
|
1296 iLog->Log( _L("CMetaDataDisplay::TestResetL returned no error") ); |
|
1297 } |
|
1298 else |
|
1299 { |
|
1300 iLog->Log( _L("CMetaDataDisplay::TestResetL returned: %d"), err ); |
|
1301 } |
|
1302 iLog->Log( _L("End calling TestResetL.") ); |
|
1303 return err; |
|
1304 } |
|
1305 |
|
1306 |
|
1307 void CMetaDataDisplay::ProcessMetaDataL( CMetaDataUtility *metaDataUtility, |
|
1308 /*CMetaDataUtilityTestAppFileDetails* aFileDetails,*/ |
|
1309 TInt error ) |
|
1310 {//TODO need to implement the code here |
|
1311 if ( error != KErrNone ) |
|
1312 { |
|
1313 // there's a problem |
|
1314 iLog->Log( _L("Pass in bad parameter(s): %d"), error ); |
|
1315 User::Leave( error ); |
|
1316 } |
|
1317 |
|
1318 TInt count = metaDataUtility->MetaDataCount(); |
|
1319 |
|
1320 for(TInt i = 0; i < count; i++) |
|
1321 { |
|
1322 TMetaDataFieldId fieldId; |
|
1323 |
|
1324 TPtrC field = metaDataUtility->MetaDataFieldsL().At( i, fieldId ); |
|
1325 if( field != KNullDesC ) |
|
1326 { |
|
1327 switch( fieldId ) |
|
1328 { |
|
1329 case EMetaDataSongTitle: |
|
1330 { |
|
1331 // SetFileDetailL( aFileDetails->iTitle, field ); |
|
1332 iLog->Log( _L("CMetaDataDisplay::ProcessMetaDataL returned: %d"), error ); |
|
1333 break; |
|
1334 } |
|
1335 case EMetaDataArtist: |
|
1336 { |
|
1337 // SetFileDetailL( aFileDetails->iArtist, field ); |
|
1338 iLog->Log( _L("CMetaDataDisplay::ProcessMetaDataL returned: %d"), error ); |
|
1339 break; |
|
1340 } |
|
1341 case EMetaDataAlbum: |
|
1342 { |
|
1343 // SetFileDetailL( aFileDetails->iAlbum, field ); |
|
1344 iLog->Log( _L("CMetaDataDisplay::ProcessMetaDataL returned: %d"), error ); |
|
1345 break; |
|
1346 } |
|
1347 case EMetaDataYear: |
|
1348 { |
|
1349 // SetFileDetailL( aFileDetails->iYear, field ); |
|
1350 iLog->Log( _L("CMetaDataDisplay::ProcessMetaDataL returned: %d"), error ); |
|
1351 break; |
|
1352 } |
|
1353 case EMetaDataComment: |
|
1354 { |
|
1355 // SetFileDetailL( aFileDetails->iComment, field ); |
|
1356 iLog->Log( _L("CMetaDataDisplay::ProcessMetaDataL returned: %d"), error ); |
|
1357 break; |
|
1358 } |
|
1359 case EMetaDataAlbumTrack: |
|
1360 { |
|
1361 // SetFileDetailL( aFileDetails->iAlbumTrack, field ); |
|
1362 iLog->Log( _L("CMetaDataDisplay::ProcessMetaDataL returned: %d"), error ); |
|
1363 break; |
|
1364 } |
|
1365 case EMetaDataGenre: |
|
1366 { |
|
1367 // SetFileDetailL( aFileDetails->iGenre, field ); |
|
1368 iLog->Log( _L("CMetaDataDisplay::ProcessMetaDataL returned: %d"), error ); |
|
1369 break; |
|
1370 } |
|
1371 case EMetaDataComposer: |
|
1372 { |
|
1373 // SetFileDetailL( aFileDetails->iComposer, field ); |
|
1374 iLog->Log( _L("CMetaDataDisplay::ProcessMetaDataL returned: %d"), error ); |
|
1375 break; |
|
1376 } |
|
1377 case EMetaDataCopyright: |
|
1378 { |
|
1379 // SetFileDetailL( aFileDetails->iCopyright, field ); |
|
1380 iLog->Log( _L("CMetaDataDisplay::ProcessMetaDataL returned: %d"), error ); |
|
1381 break; |
|
1382 } |
|
1383 case EMetaDataOriginalArtist: |
|
1384 { |
|
1385 // SetFileDetailL( aFileDetails->iOriginalArtist, field ); |
|
1386 iLog->Log( _L("CMetaDataDisplay::ProcessMetaDataL returned: %d"), error ); |
|
1387 break; |
|
1388 } |
|
1389 case EMetaDataUserUrl: |
|
1390 case EMetaDataUrl: |
|
1391 { |
|
1392 // SetFileDetailL( aFileDetails->iAudioFileWebPage, field ); |
|
1393 iLog->Log( _L("CMetaDataDisplay::ProcessMetaDataL returned: %d"), error ); |
|
1394 break; |
|
1395 } |
|
1396 case EMetaDataJpeg: |
|
1397 { |
|
1398 //SetFileDetailL( aFileDetails->iAlbumArt, field ); |
|
1399 iLog->Log( _L("CMetaDataDisplay::ProcessMetaDataL returned: %d"), error ); |
|
1400 break; |
|
1401 } |
|
1402 case EMetaDataVendor: |
|
1403 { |
|
1404 // SetFileDetailL( aFileDetails->iVendor, field ); |
|
1405 iLog->Log( _L("CMetaDataDisplay::ProcessMetaDataL returned: %d"), error ); |
|
1406 break; |
|
1407 } |
|
1408 case EMetaDataRating: |
|
1409 { |
|
1410 // SetFileDetailL( aFileDetails->iRating, field ); |
|
1411 iLog->Log( _L("CMetaDataDisplay::ProcessMetaDataL returned: %d"), error ); |
|
1412 break; |
|
1413 } |
|
1414 case EMetaDataDuration: |
|
1415 { |
|
1416 // SetFileDetailL( aFileDetails->iComposer, field ); |
|
1417 iLog->Log( _L("CMetaDataDisplay::ProcessMetaDataL returned: %d"), error ); |
|
1418 break; |
|
1419 } |
|
1420 default: |
|
1421 { |
|
1422 // nothing to do |
|
1423 break; |
|
1424 } |
|
1425 } |
|
1426 } |
|
1427 } |
|
1428 } |
|
1429 |
|
1430 |
|
1431 // ----------------------------------------------------------------------------- |
|
1432 // CMetaDataDisplay::TestInitChunkData |
|
1433 // InitChunkData test method function. |
|
1434 // (other items were commented in a header). |
|
1435 // ----------------------------------------------------------------------------- |
|
1436 // |
|
1437 TInt CMetaDataDisplay::TestInitChunkData(CStifItemParser& aItem ) |
|
1438 { |
|
1439 iLog->Log( _L("Entering TestInitChunkData.") ); |
|
1440 TInt err = KErrNone; |
|
1441 TPtrC FileNamePtr; |
|
1442 TInt isMimeUsed; |
|
1443 HBufC8 *SoundFile; |
|
1444 HBufC8 *SoundFileDes; |
|
1445 |
|
1446 if ( aItem.GetNextString( FileNamePtr ) == KErrNone ) |
|
1447 { |
|
1448 TBuf<120> KFrom; |
|
1449 KFrom.Append(KMetaDataDisplay_testPath); |
|
1450 KFrom.Append(FileNamePtr); |
|
1451 TFileName FileName = KFrom; |
|
1452 |
|
1453 iLog->Log( _L("Input file [%S]"), &FileNamePtr ); |
|
1454 SoundFileDes = TestGetDescriptor8LC( FileName ); |
|
1455 if( ( err = aItem.GetNextInt( isMimeUsed ) ) == KErrNone ) |
|
1456 { |
|
1457 if( isMimeUsed ) |
|
1458 { |
|
1459 SoundFile = GetDescriptor8LC( FileName,ETrue ); |
|
1460 } |
|
1461 else |
|
1462 { |
|
1463 SoundFile = GetDescriptor8LC( FileName,EFalse ); |
|
1464 } |
|
1465 } |
|
1466 else |
|
1467 { |
|
1468 iLog->Log( _L("Bad parameter is passed in.") ); |
|
1469 User::Leave( err ); |
|
1470 } |
|
1471 |
|
1472 if( SoundFileDes && SoundFile ) |
|
1473 { |
|
1474 err = iChunkDataTester->TestInitChunkDataAPI( *SoundFile ); |
|
1475 |
|
1476 if( err == KBadParameter ) |
|
1477 { |
|
1478 iLog->Log( _L("Pass in bad parameter(s): %d"), err ); |
|
1479 User::Leave( err ); |
|
1480 } |
|
1481 else if ( err != KErrNone ) |
|
1482 { |
|
1483 iLog->Log( _L("CMetaDataDisplay::TestInitChunkData returned: %d"), err ); |
|
1484 User::Leave( err ); |
|
1485 } |
|
1486 else |
|
1487 { |
|
1488 iLog->Log( _L("CMetaDataDisplay::TestInitChunkData returned no error") ); |
|
1489 } |
|
1490 |
|
1491 //[Arnel and Flo] |
|
1492 //close the metadata utility and delete the tester object |
|
1493 //Add CMetaDataDisplay::DestructChunkDataTester to delete the tester object |
|
1494 //and call the close and delete function in cfg file |
|
1495 } |
|
1496 |
|
1497 CleanupStack::PopAndDestroy( 2 ); |
|
1498 |
|
1499 } |
|
1500 iLog->Log( _L("End calling TestInitChunkData.") ); |
|
1501 return err; |
|
1502 } |
|
1503 |
|
1504 // ----------------------------------------------------------------------------- |
|
1505 // CMetaDataDisplay::TestProcessChunkData |
|
1506 // ProcessChunkData test method function. |
|
1507 // (other items were commented in a header). |
|
1508 // ----------------------------------------------------------------------------- |
|
1509 // |
|
1510 TInt CMetaDataDisplay::TestProcessChunkData(CStifItemParser& aItem ) |
|
1511 { |
|
1512 iLog->Log( _L("Entering TestProcessChunkData.") ); |
|
1513 TInt err = KErrNone; |
|
1514 TPtrC FileNamePtr; |
|
1515 TInt isMimeUsed; |
|
1516 HBufC8 *SoundFile; |
|
1517 HBufC8 *SoundFileDes; |
|
1518 if ( aItem.GetNextString( FileNamePtr ) == KErrNone ) |
|
1519 { |
|
1520 TBuf<120> KFrom; |
|
1521 KFrom.Append(KMetaDataDisplay_testPath); |
|
1522 KFrom.Append(FileNamePtr); |
|
1523 TFileName FileName = KFrom; |
|
1524 |
|
1525 iLog->Log( _L("Input file [%S]"), &FileNamePtr ); |
|
1526 SoundFileDes = TestGetDescriptor8LC( FileName ); |
|
1527 if( ( err = aItem.GetNextInt( isMimeUsed ) ) == KErrNone ) |
|
1528 { |
|
1529 if( isMimeUsed ) |
|
1530 { |
|
1531 SoundFile = GetDescriptor8LC( FileName,ETrue ); |
|
1532 } |
|
1533 else |
|
1534 { |
|
1535 SoundFile = GetDescriptor8LC( FileName,EFalse ); |
|
1536 } |
|
1537 } |
|
1538 else |
|
1539 { |
|
1540 iLog->Log( _L("Bad parameter is passed in.") ); |
|
1541 User::Leave( err ); |
|
1542 } |
|
1543 |
|
1544 if( SoundFileDes && SoundFile ) |
|
1545 { |
|
1546 err = iChunkDataTester->TestInitChunkDataAPI( *SoundFile ); |
|
1547 if ( err == KErrNone ) |
|
1548 { |
|
1549 // error can be KErrInvalidArg (e.g., chunk size too large) |
|
1550 //[Arnel and Flo] |
|
1551 // This method will also test parsing when the metadatautility reaches a |
|
1552 // state where the data is ready to be parsed. |
|
1553 err = iChunkDataTester->TestProcessChunkDataAPI( FileName ); |
|
1554 } |
|
1555 |
|
1556 // setup for a callback from the tester |
|
1557 iChunkDataTester->WaitToProcessMetaData( this ); |
|
1558 |
|
1559 //[Arnel and Flo] |
|
1560 //In the callback, maybe you should close the metadata utility and delete the tester object? |
|
1561 } |
|
1562 |
|
1563 if ( err == KBadParameter ) |
|
1564 { |
|
1565 iLog->Log( _L("Pass in bad parameter(s): %d"), err ); |
|
1566 User::Leave( err ); |
|
1567 } |
|
1568 else if ( err != KErrNone ) |
|
1569 { |
|
1570 iLog->Log( _L("CMetaDataDisplay::TestProcessChunkData returned: %d"), err ); |
|
1571 User::Leave( err ); |
|
1572 } |
|
1573 else |
|
1574 { |
|
1575 iLog->Log( _L("CMetaDataDisplay::TestProcessChunkData returned no error") ); |
|
1576 } |
|
1577 |
|
1578 CleanupStack::PopAndDestroy( 2 ); |
|
1579 |
|
1580 //[Arnel and Flo] |
|
1581 //close the metadata utility and delete the tester object |
|
1582 //Add CMetaDataDisplay::DestructChunkDataTester to delete the tester object |
|
1583 //and call the close and delete function in cfg file |
|
1584 } |
|
1585 iLog->Log( _L("End calling TestProcessChunkData.") ); |
|
1586 return err; |
|
1587 } |
|
1588 |
|
1589 // ----------------------------------------------------------------------------- |
|
1590 // CMetaDataDisplay::TestParseChunkData |
|
1591 // ParseChunkData test method function. |
|
1592 // (other items were commented in a header). |
|
1593 // ----------------------------------------------------------------------------- |
|
1594 // |
|
1595 //[Arnel and Flo] |
|
1596 // This can be removed since parsing is also tested by TestProcessChunkData(). |
|
1597 |
|
1598 |
|
1599 // ----------------------------------------------------------------------------- |
|
1600 // CMetaDataDisplay::TestIsNotChunkDataMode |
|
1601 // TestIsChunkDataModeAPI "not in chunk data mode" test method function. |
|
1602 // (other items were commented in a header). |
|
1603 // ----------------------------------------------------------------------------- |
|
1604 // |
|
1605 TInt CMetaDataDisplay::TestIsNotChunkDataMode(CStifItemParser& /*aItem*/ ) |
|
1606 { |
|
1607 iLog->Log( _L("---------->Entering TestIsNotChunkDataMode") ); |
|
1608 TBool isChunkDataMode = iChunkDataTester->TestIsChunkDataModeAPI(); |
|
1609 //[Flo and Arnel] |
|
1610 // The result should be "not in chunk data mode" at this point since we have not |
|
1611 // done the Init() yet. |
|
1612 |
|
1613 // The Init() must be called before calling TestIsChunkDataModeAPI() |
|
1614 // so we separate two test cases to verify whether it is in Chunk Data mode |
|
1615 if( isChunkDataMode ) |
|
1616 { |
|
1617 iLog->Log( _L("It is in Chunk Data mode") ); |
|
1618 User::Leave(-1); |
|
1619 } |
|
1620 else |
|
1621 { |
|
1622 iLog->Log( _L("It is not in Chunk Data mode") ); |
|
1623 } |
|
1624 iLog->Log( _L("<----------End of TestIsNotChunkDataMode") ); |
|
1625 |
|
1626 //[Arnel and Flo] |
|
1627 //close the metadata utility and delete the tester object |
|
1628 //Add CMetaDataDisplay::DestructChunkDataTester to delete the tester object |
|
1629 //and call the close and delete function in cfg file |
|
1630 return KErrNone; |
|
1631 } |
|
1632 |
|
1633 // ----------------------------------------------------------------------------- |
|
1634 // CMetaDataDisplay::TestIsChunkDataMode |
|
1635 // TestIsChunkDataModeAPI "in chunk data mode" test method function. |
|
1636 // (other items were commented in a header). |
|
1637 // ----------------------------------------------------------------------------- |
|
1638 // |
|
1639 TInt CMetaDataDisplay::TestIsChunkDataMode(CStifItemParser& /*aItem*/ ) |
|
1640 { |
|
1641 iLog->Log( _L("---------->Entering TestIsChunkDataMode") ); |
|
1642 TBool isChunkDataMode = iChunkDataTester->TestIsChunkDataModeAPI(); |
|
1643 |
|
1644 //[Flo and Arnel] |
|
1645 // Now, let's do the init and the result should be "in chunk data mode". |
|
1646 // InitChunkData(); // TODO: implement this |
|
1647 |
|
1648 // The Init() must be called before calling TestIsChunkDataModeAPI() |
|
1649 // so we separate two test cases to verify whether it is in Chunk Data mode |
|
1650 // and the funcation init() is called in cfg file |
|
1651 if( isChunkDataMode ) |
|
1652 { |
|
1653 iLog->Log( _L("It is in Chunk Data mode") ); |
|
1654 } |
|
1655 else |
|
1656 { |
|
1657 iLog->Log( _L("It is not in Chunk Data mode") ); |
|
1658 User::Leave(-1); |
|
1659 } |
|
1660 |
|
1661 iLog->Log( _L("<----------End of TestIsChunkDataMode") ); |
|
1662 |
|
1663 //[Arnel and Flo] |
|
1664 //close the metadata utility and delete the tester object |
|
1665 //Add CMetaDataDisplay::DestructChunkDataTester to delete the tester object |
|
1666 //and call the close and delete function in cfg file |
|
1667 return KErrNone; |
|
1668 } |
|
1669 |
|
1670 |
|
1671 // ----------------------------------------------------------------------------- |
|
1672 // CMetaDataDisplay::TestCloseChunkData |
|
1673 // CloseChunkData test method function. |
|
1674 // (other items were commented in a header). |
|
1675 // ----------------------------------------------------------------------------- |
|
1676 // |
|
1677 TInt CMetaDataDisplay::TestCloseChunkData(CStifItemParser& /*aItem*/ ) |
|
1678 { |
|
1679 iLog->Log( _L("---------->Entering TestCloseChunkData") ); |
|
1680 iChunkDataTester->TestCloseChunkDataAPI(); |
|
1681 iLog->Log( _L("<----------End of TestCloseChunkData") ); |
|
1682 return KErrNone; |
|
1683 } |
|
1684 |
|
1685 // ----------------------------------------------------------------------------- |
|
1686 // CMetaDataDisplay::CreateChunkDataTester |
|
1687 // CreateChunkDataTester test method function. |
|
1688 // (other items were commented in a header). |
|
1689 // ----------------------------------------------------------------------------- |
|
1690 // |
|
1691 TInt CMetaDataDisplay::CreateChunkDataTester( CStifItemParser& /*aItem*/ ) |
|
1692 { |
|
1693 iLog->Log( _L("-------->Create ChunkDataAPITester...") ); |
|
1694 TInt result = KErrNone; |
|
1695 TRAP( result,iChunkDataTester = CChunkDataAPITester::NewL() ); |
|
1696 if( result == KErrNone ) |
|
1697 { |
|
1698 iLog->Log( _L("Successfully create ChunkDataAPITester.") ); |
|
1699 } |
|
1700 else |
|
1701 { |
|
1702 iLog->Log( _L("Fail to create ChunkDataAPITester.Error %d return."),result ); |
|
1703 } |
|
1704 iLog->Log( _L("<--------The end of creation of ChunkDataAPITester.") ); |
|
1705 return result; |
|
1706 } |
|
1707 |
|
1708 // ----------------------------------------------------------------------------- |
|
1709 // CMetaDataDisplay::DestructChunkDataTester |
|
1710 // Delete the tester object test method function. |
|
1711 // (other items were commented in a header). |
|
1712 // ----------------------------------------------------------------------------- |
|
1713 // |
|
1714 TInt CMetaDataDisplay::DestructChunkDataTester( CStifItemParser& /*aItem*/ ) |
|
1715 { |
|
1716 TInt err = KErrNone; |
|
1717 delete iChunkDataTester; |
|
1718 iChunkDataTester = NULL; |
|
1719 iLog->Log( _L("CMetaDataDisplay::DestructChunkDataTester testing ~CChunkDataAPITester end err=%d"), err); |
|
1720 return err; |
|
1721 } |
|
1722 |
|
1723 |
|
1724 /****************************************************************************************** |
|
1725 * |
|
1726 * Test functions for CMetaDataFieldContainer |
|
1727 * |
|
1728 ******************************************************************************************/ |
|
1729 // ----------------------------------------------------------------------------- |
|
1730 // CMetaDataDisplay::GetContainerViaMetaDataUtility |
|
1731 // CloseChunkData test method function. |
|
1732 // (other items were commented in a header). |
|
1733 // ----------------------------------------------------------------------------- |
|
1734 // |
|
1735 TInt CMetaDataDisplay::GetContainerViaMetaDataUtility( CStifItemParser& /*aItem*/ ) |
|
1736 { |
|
1737 iLog->Log( _L("") );//A blank line makes the log file look better |
|
1738 iLog->Log( _L("Entering GetContainerViaMetaDataUtility-->") ); |
|
1739 TInt result( 0 ); |
|
1740 //iContainer = &iMetaData->MetaDataFieldsL(); |
|
1741 TRAP( result,iContainer = &iMetaData->MetaDataFieldsL() ); |
|
1742 if( result == KErrNone ) |
|
1743 { |
|
1744 iLog->Log( _L("Succeeded to get CMetaDataFieldContainer.") ); |
|
1745 } |
|
1746 else |
|
1747 { |
|
1748 iLog->Log( _L("Failed to create CMetaDataFieldContainer.Error %d returns."),result ); |
|
1749 } |
|
1750 iLog->Log( _L("<--Out of GetContainerViaMetaDataUtility.") ); |
|
1751 return result; |
|
1752 } |
|
1753 // ----------------------------------------------------------------------------- |
|
1754 // CMetaDataDisplay::ContainerCount |
|
1755 // CloseChunkData test method function. |
|
1756 // (other items were commented in a header). |
|
1757 // ----------------------------------------------------------------------------- |
|
1758 // |
|
1759 TInt CMetaDataDisplay::ContainerCount( CStifItemParser& /*aItem*/ ) |
|
1760 { |
|
1761 iLog->Log( _L("") );//A blank line makes the log file look better |
|
1762 iLog->Log( _L("Entering ContainerCount-->") ); |
|
1763 TInt result( 0 ); |
|
1764 TInt count = iContainer->Count(); |
|
1765 iLog->Log( _L("The number of meta data fields is %d."),count ); |
|
1766 iLog->Log( _L("<--Out of ContainerCount.") ); |
|
1767 return result; |
|
1768 } |
|
1769 // ----------------------------------------------------------------------------- |
|
1770 // CMetaDataDisplay::ContainerField |
|
1771 // CloseChunkData test method function. |
|
1772 // (other items were commented in a header). |
|
1773 // ----------------------------------------------------------------------------- |
|
1774 // |
|
1775 TInt CMetaDataDisplay::ContainerField( CStifItemParser& aItem ) |
|
1776 { |
|
1777 iLog->Log( _L("") );//A blank line makes the log file look better |
|
1778 iLog->Log( _L("Entering ContainerField-->") ); |
|
1779 TInt result( 0 ); |
|
1780 TInt fieldId; |
|
1781 while( aItem.GetNextInt( fieldId ) == KErrNone ) |
|
1782 { |
|
1783 if( ( 0 <= fieldId ) && ( fieldId <= 19) ) |
|
1784 { |
|
1785 TMetaDataFieldId tempFieldId = (TMetaDataFieldId)fieldId; |
|
1786 TPtrC field = iContainer->Field( tempFieldId ); |
|
1787 switch( tempFieldId ) |
|
1788 {//There are 19 cases to be processed,I am not gonna to process all of them |
|
1789 case EUnknownMetaDataField: |
|
1790 { |
|
1791 if( field == KNullDesC() ) |
|
1792 { |
|
1793 iLog->Log( _L("The content of meta data field EUnknownMetaDataField is NULL.") ); |
|
1794 } |
|
1795 else |
|
1796 { |
|
1797 iLog->Log( _L("The content of meta data field EUnknownMetaDataField is [%S]."),field.Alloc() ); |
|
1798 } |
|
1799 break; |
|
1800 } |
|
1801 |
|
1802 case EMetaDataSongTitle: |
|
1803 { |
|
1804 if( field == KNullDesC() ) |
|
1805 { |
|
1806 iLog->Log( _L("The content of meta data field EMetaDataSongTitle is NULL.") ); |
|
1807 } |
|
1808 else |
|
1809 { |
|
1810 iLog->Log( _L("The content of meta data field EMetaDataSongTitle is [%S]."),field.Alloc() ); |
|
1811 } |
|
1812 break; |
|
1813 } |
|
1814 |
|
1815 case EMetaDataArtist: |
|
1816 { |
|
1817 if( field == KNullDesC() ) |
|
1818 { |
|
1819 iLog->Log( _L("The content of meta data field EMetaDataArtist is NULL.") ); |
|
1820 } |
|
1821 else |
|
1822 { |
|
1823 iLog->Log( _L("The content of meta data field EMetaDataArtist is [%S]."),field.Alloc() ); |
|
1824 } |
|
1825 break; |
|
1826 } |
|
1827 |
|
1828 case EMetaDataAlbum: |
|
1829 { |
|
1830 if( field == KNullDesC() ) |
|
1831 { |
|
1832 iLog->Log( _L("The content of meta data field EMetaDataAlbum is NULL.") ); |
|
1833 } |
|
1834 else |
|
1835 { |
|
1836 iLog->Log( _L("The content of meta data field EMetaDataAlbum is [%S]."),field.Alloc() ); |
|
1837 } |
|
1838 break; |
|
1839 } |
|
1840 |
|
1841 case EMetaDataDuration: |
|
1842 { |
|
1843 if( field == KNullDesC() ) |
|
1844 { |
|
1845 iLog->Log( _L("The content of meta data field EMetaDataDuration is NULL.") ); |
|
1846 } |
|
1847 else |
|
1848 { |
|
1849 iLog->Log( _L("The content of meta data field EMetaDataDuration is [%S]."),field.Alloc() ); |
|
1850 } |
|
1851 break; |
|
1852 } |
|
1853 |
|
1854 case EMetaDataDate: |
|
1855 { |
|
1856 if( field == KNullDesC() ) |
|
1857 { |
|
1858 iLog->Log( _L("The content of meta data field EMetaDataDate is NULL.") ); |
|
1859 } |
|
1860 else |
|
1861 { |
|
1862 iLog->Log( _L("The content of meta data field EMetaDataDate is [%S]."),field.Alloc() ); |
|
1863 } |
|
1864 break; |
|
1865 } |
|
1866 |
|
1867 default: |
|
1868 { |
|
1869 if( field == KNullDesC() ) |
|
1870 { |
|
1871 iLog->Log( _L("The content of meta data field [%d] is NULL."),tempFieldId ); |
|
1872 } |
|
1873 else |
|
1874 { |
|
1875 iLog->Log( _L("The content of meta data field [%d] is [%S]."),field.Alloc() ); |
|
1876 } |
|
1877 break; |
|
1878 } |
|
1879 } |
|
1880 } |
|
1881 else |
|
1882 { |
|
1883 result= KBadParameter; |
|
1884 iLog->Log( _L("<--The meta data field Id you input is out of bound( 0 <= Id <= 19 ).User leaves here.") ); |
|
1885 User::Leave( KBadParameter ); |
|
1886 } |
|
1887 } |
|
1888 iLog->Log( _L("<--Out of ContainerField.") ); |
|
1889 return result; |
|
1890 } |
|
1891 // ----------------------------------------------------------------------------- |
|
1892 // CMetaDataDisplay::ContainerField8 |
|
1893 // CloseChunkData test method function. |
|
1894 // (other items were commented in a header). |
|
1895 // ----------------------------------------------------------------------------- |
|
1896 // |
|
1897 TInt CMetaDataDisplay::ContainerField8( CStifItemParser& aItem ) |
|
1898 { |
|
1899 iLog->Log( _L("") );//A blank line makes the log file look better |
|
1900 iLog->Log( _L("Entering ContainerField8-->") ); |
|
1901 TInt result( 0 ); |
|
1902 TInt fieldId; |
|
1903 while( aItem.GetNextInt( fieldId ) == KErrNone ) |
|
1904 { |
|
1905 if( ( 0 <= fieldId ) && ( fieldId <= 19 ) ) |
|
1906 { |
|
1907 TMetaDataFieldId tempFieldId = (TMetaDataFieldId)fieldId; |
|
1908 TPtrC8 field = iContainer->Field8( tempFieldId ); |
|
1909 switch( tempFieldId ) |
|
1910 {//There are 19 cases to be processed,I am not gonna to process all of them |
|
1911 case EUnknownMetaDataField: |
|
1912 { |
|
1913 if( field == KNullDesC8() ) |
|
1914 { |
|
1915 iLog->Log( _L("The content of meta data field EUnknownMetaDataField is NULL.") ); |
|
1916 } |
|
1917 else |
|
1918 { |
|
1919 iLog->Log( _L("The content of meta data field EUnknownMetaDataField is [%S]."),field.Alloc() ); |
|
1920 } |
|
1921 break; |
|
1922 } |
|
1923 |
|
1924 case EMetaDataSongTitle: |
|
1925 { |
|
1926 if( field == KNullDesC8() ) |
|
1927 { |
|
1928 iLog->Log( _L("The content of meta data field EMetaDataSongTitle is NULL.") ); |
|
1929 } |
|
1930 else |
|
1931 { |
|
1932 iLog->Log( _L("The content of meta data field EMetaDataSongTitle is [%S]."),field.Alloc() ); |
|
1933 } |
|
1934 break; |
|
1935 } |
|
1936 |
|
1937 case EMetaDataArtist: |
|
1938 { |
|
1939 if( field == KNullDesC8() ) |
|
1940 { |
|
1941 iLog->Log( _L("The content of meta data field EMetaDataArtist is NULL.") ); |
|
1942 } |
|
1943 else |
|
1944 { |
|
1945 iLog->Log( _L("The content of meta data field EMetaDataArtist is [%S]."),field.Alloc() ); |
|
1946 } |
|
1947 break; |
|
1948 } |
|
1949 |
|
1950 case EMetaDataAlbum: |
|
1951 { |
|
1952 if( field == KNullDesC8() ) |
|
1953 { |
|
1954 iLog->Log( _L("The content of meta data field EMetaDataAlbum is NULL.") ); |
|
1955 } |
|
1956 else |
|
1957 { |
|
1958 iLog->Log( _L("The content of meta data field EMetaDataAlbum is [%S]."),field.Alloc() ); |
|
1959 } |
|
1960 break; |
|
1961 } |
|
1962 |
|
1963 case EMetaDataDuration: |
|
1964 { |
|
1965 if( field == KNullDesC8() ) |
|
1966 { |
|
1967 iLog->Log( _L("The content of meta data field EMetaDataDuration is NULL.") ); |
|
1968 } |
|
1969 else |
|
1970 { |
|
1971 iLog->Log( _L("The content of meta data field EMetaDataDuration is [%S]."),field.Alloc() ); |
|
1972 } |
|
1973 break; |
|
1974 } |
|
1975 |
|
1976 case EMetaDataDate: |
|
1977 { |
|
1978 if( field == KNullDesC8() ) |
|
1979 { |
|
1980 iLog->Log( _L("The content of meta data field EMetaDataDate is NULL.") ); |
|
1981 } |
|
1982 else |
|
1983 { |
|
1984 iLog->Log( _L("The content of meta data field EMetaDataDate is [%S]."),field.Alloc() ); |
|
1985 } |
|
1986 break; |
|
1987 } |
|
1988 |
|
1989 default: |
|
1990 { |
|
1991 if( field == KNullDesC8() ) |
|
1992 { |
|
1993 iLog->Log( _L("The content of meta data field [%d] is NULL."),tempFieldId ); |
|
1994 } |
|
1995 else |
|
1996 { |
|
1997 iLog->Log( _L("The content of meta data field [%d] is [%S]."),field.Alloc() ); |
|
1998 } |
|
1999 break; |
|
2000 } |
|
2001 } |
|
2002 } |
|
2003 else |
|
2004 { |
|
2005 result= KBadParameter; |
|
2006 iLog->Log( _L("<--The meta data field Id you input is out of bound( 0 <= Id <= 19 ).User leaves here.") ); |
|
2007 User::Leave( KBadParameter ); |
|
2008 } |
|
2009 } |
|
2010 iLog->Log( _L("<--Out of ContainerField8.") ); |
|
2011 return result; |
|
2012 } |
|
2013 // ----------------------------------------------------------------------------- |
|
2014 // CMetaDataDisplay::ContainerAppendLTDesCL |
|
2015 // CloseChunkData test method function. |
|
2016 // (other items were commented in a header). |
|
2017 // ----------------------------------------------------------------------------- |
|
2018 // |
|
2019 TInt CMetaDataDisplay::ContainerAppendLTDesCL( CStifItemParser& aItem ) |
|
2020 { |
|
2021 iLog->Log( _L("") );//A blank line makes the log file look better |
|
2022 iLog->Log( _L("Entering ContainerAppendLTDesCL-->") ); |
|
2023 TInt result( 0 ); |
|
2024 TInt fieldId; |
|
2025 TInt NumOfFieldAppended( 0 ); |
|
2026 if( aItem.GetNextInt( NumOfFieldAppended ) == KErrNone ) |
|
2027 { |
|
2028 if( ( 0 < NumOfFieldAppended ) && ( NumOfFieldAppended <= 19 ) ) |
|
2029 { |
|
2030 for( TInt num = NumOfFieldAppended ; (num--)>0 ; ) |
|
2031 { |
|
2032 TInt fieldTemp; |
|
2033 TPtrC fieldContent; |
|
2034 if( aItem.GetNextInt( fieldTemp ) == KErrNone ) |
|
2035 { |
|
2036 if( ( 0 <= fieldTemp ) && ( fieldTemp <= 19 ) ) |
|
2037 { |
|
2038 fieldId = fieldTemp; |
|
2039 if( aItem.GetNextString( fieldContent ) == KErrNone ) |
|
2040 { |
|
2041 iLog->Log( _L("Meta data field [%d] is being appended."),fieldId ); |
|
2042 iLog->Log( _L("Content of the just appended meta data field is [%S]."),fieldContent.Alloc() ); |
|
2043 TMetaDataFieldId tempFieldId = (TMetaDataFieldId)fieldId; |
|
2044 //const_cast<CMetaDataFieldContainer*>(iContainer)->AppendL( tempFieldId, fieldContent ); //TODO |
|
2045 TRAP( result,const_cast<CMetaDataFieldContainer*>(iContainer)->AppendL( tempFieldId, fieldContent ) ); |
|
2046 if( result == KErrNone ) |
|
2047 { |
|
2048 iLog->Log( _L("Succeeded to append meta data field [%d]."),fieldId ); |
|
2049 } |
|
2050 else |
|
2051 { |
|
2052 iLog->Log( _L("Failed to append meta data field [%d].Error [%d] returns."),fieldId,result ); |
|
2053 } |
|
2054 } |
|
2055 else |
|
2056 { |
|
2057 result = KBadParameter; |
|
2058 iLog->Log( _L("Pass in bad parameter.User Leave here.") ); |
|
2059 User::Leave( KBadParameter ); |
|
2060 } |
|
2061 } |
|
2062 else |
|
2063 { |
|
2064 result= KBadParameter; |
|
2065 iLog->Log( _L("<--The meta data field Id [%d] you input is out of bound( 0 <= Id <= 19 ).User leaves here."),fieldTemp ); |
|
2066 User::Leave( KBadParameter ); |
|
2067 } |
|
2068 |
|
2069 } |
|
2070 else |
|
2071 { |
|
2072 result = KBadParameter; |
|
2073 iLog->Log( _L("Pass in bad parameter.User Leave here.") ); |
|
2074 User::Leave( KBadParameter ); |
|
2075 } |
|
2076 } |
|
2077 } |
|
2078 else if( NumOfFieldAppended == 0 ) |
|
2079 { |
|
2080 result = KErrNone; |
|
2081 iLog->Log( _L("No meta data field is appended.") ); |
|
2082 } |
|
2083 else |
|
2084 { |
|
2085 result= KBadParameter; |
|
2086 iLog->Log( _L("<--The meta data field number you want to input is out of bound( 0 <= Id <= 19 ).User leaves here.") ); |
|
2087 User::Leave( KBadParameter ); |
|
2088 } |
|
2089 } |
|
2090 else |
|
2091 { |
|
2092 result = KBadParameter; |
|
2093 iLog->Log( _L("Pass in bad parameter.User Leave here.") ); |
|
2094 User::Leave( KBadParameter ); |
|
2095 } |
|
2096 iLog->Log( _L("<--Out of ContainerAppendLTDesCL.") ); |
|
2097 return result; |
|
2098 } |
|
2099 // ----------------------------------------------------------------------------- |
|
2100 // CMetaDataDisplay::ContainerAppendLTDesC8L |
|
2101 // CloseChunkData test method function. |
|
2102 // (other items were commented in a header). |
|
2103 // ----------------------------------------------------------------------------- |
|
2104 // |
|
2105 TInt CMetaDataDisplay::ContainerAppendLTDesC8L( CStifItemParser& aItem ) |
|
2106 { |
|
2107 iLog->Log( _L("") );//A blank line makes the log file look better |
|
2108 iLog->Log( _L("Entering ContainerAppendLTDesC8L-->") ); |
|
2109 TInt result( 0 ); |
|
2110 TInt fieldId; |
|
2111 TInt NumOfFieldAppended( 0 ); |
|
2112 if( aItem.GetNextInt( NumOfFieldAppended ) == KErrNone ) |
|
2113 { |
|
2114 if( ( 0 < NumOfFieldAppended ) && ( NumOfFieldAppended <= 19 ) ) |
|
2115 { |
|
2116 for( TInt num = NumOfFieldAppended ; (num--)>0 ; ) |
|
2117 { |
|
2118 TInt fieldTemp; |
|
2119 TPtrC fieldContent; |
|
2120 if( aItem.GetNextInt( fieldTemp ) == KErrNone ) |
|
2121 { |
|
2122 if( ( 0 <= fieldTemp ) && ( fieldTemp <= 19 ) ) |
|
2123 { |
|
2124 fieldId = fieldTemp; |
|
2125 if( aItem.GetNextString( fieldContent ) == KErrNone ) |
|
2126 { |
|
2127 iLog->Log( _L("Meta data field [%d] is being appended."),fieldId ); |
|
2128 iLog->Log( _L("Content of the just appended meta data field is [%S]."),fieldContent.Alloc() ); |
|
2129 TMetaDataFieldId tempFieldId = (TMetaDataFieldId)fieldId; |
|
2130 TBuf<20> fieldBuf16; |
|
2131 fieldBuf16.Copy( fieldContent ); |
|
2132 TBuf8<40> fieldBuf8; |
|
2133 CnvUtfConverter::ConvertFromUnicodeToUtf8( fieldBuf8,fieldBuf16 ); |
|
2134 //const_cast<CMetaDataFieldContainer*>(iContainer)->AppendL( tempFieldId,fieldBuf8 ); //TODO |
|
2135 TRAP( result,const_cast<CMetaDataFieldContainer*>(iContainer)->AppendL( tempFieldId,fieldBuf8 ) ); |
|
2136 if( result == KErrNone ) |
|
2137 { |
|
2138 iLog->Log( _L("Succeeded to append meta data field [%d]."),fieldId ); |
|
2139 } |
|
2140 else |
|
2141 { |
|
2142 iLog->Log( _L("Failed to append meta data field [%d].Error [%d] returns."),fieldId,result ); |
|
2143 } |
|
2144 } |
|
2145 else |
|
2146 { |
|
2147 result = KBadParameter; |
|
2148 iLog->Log( _L("Pass in bad parameter.User Leaves here.") ); |
|
2149 User::Leave( KBadParameter ); |
|
2150 } |
|
2151 } |
|
2152 else |
|
2153 { |
|
2154 result= KBadParameter; |
|
2155 iLog->Log( _L("<--The meta data field Id [%d] you input is out of bound( 0 <= Id <= 19 ).User leaves here."),fieldTemp ); |
|
2156 User::Leave( KBadParameter ); |
|
2157 } |
|
2158 } |
|
2159 else |
|
2160 { |
|
2161 result = KBadParameter; |
|
2162 iLog->Log( _L("Pass in bad parameter.User Leaves here.") ); |
|
2163 User::Leave( KBadParameter ); |
|
2164 } |
|
2165 } |
|
2166 } |
|
2167 else if( NumOfFieldAppended == 0 ) |
|
2168 { |
|
2169 result = KErrNone; |
|
2170 iLog->Log( _L("No meta data field is appended.") ); |
|
2171 } |
|
2172 else |
|
2173 { |
|
2174 result= KBadParameter; |
|
2175 iLog->Log( _L("<--The meta data field number you want to input is out of bound( 0 <= Id <= 19 ).User leaves here.") ); |
|
2176 User::Leave( KBadParameter ); |
|
2177 } |
|
2178 } |
|
2179 else |
|
2180 { |
|
2181 result = KBadParameter; |
|
2182 iLog->Log( _L("Pass in bad parameter.User Leaves here.") ); |
|
2183 User::Leave( KBadParameter ); |
|
2184 } |
|
2185 iLog->Log( _L("<--Out of ContainerAppendLTDesC8L.") ); |
|
2186 return result; |
|
2187 } |
|
2188 // ----------------------------------------------------------------------------- |
|
2189 // CMetaDataDisplay::ContainerAt |
|
2190 // CloseChunkData test method function. |
|
2191 // (other items were commented in a header). |
|
2192 // ----------------------------------------------------------------------------- |
|
2193 // |
|
2194 TInt CMetaDataDisplay::ContainerAt( CStifItemParser& aItem ) |
|
2195 { |
|
2196 iLog->Log( _L("") );//A blank line makes the log file look better |
|
2197 iLog->Log( _L("Entering ContainerAt-->") ); |
|
2198 TInt result( 0 ); |
|
2199 TInt position; |
|
2200 TInt paraError( aItem.GetNextInt( position ) ); |
|
2201 if( paraError == KErrNone ) |
|
2202 { |
|
2203 while( paraError == KErrNone ) |
|
2204 { |
|
2205 if( ( 0 <= position ) && ( position <= 19 ) ) |
|
2206 { |
|
2207 TMetaDataFieldId tempFieldId; |
|
2208 TPtrC content = iContainer->At( position,tempFieldId ); |
|
2209 if( content == KNullDesC() ) |
|
2210 { |
|
2211 iLog->Log( _L("The content of the meta data field [%d] is NULL."),tempFieldId ); |
|
2212 } |
|
2213 else |
|
2214 { |
|
2215 iLog->Log( _L("The content of the meta data field [%d] is [%S]."),tempFieldId,content.Alloc() ); |
|
2216 } |
|
2217 result = KErrNone; |
|
2218 paraError= aItem.GetNextInt( position ); |
|
2219 if( paraError != KErrNone ) |
|
2220 { |
|
2221 iLog->Log( _L("Pass in no parameter.Get out of the while-loop-clause here.") ); |
|
2222 break; |
|
2223 //User::Leave( KBadParameter ); |
|
2224 } |
|
2225 } |
|
2226 else |
|
2227 { |
|
2228 result = KBadParameter; |
|
2229 iLog->Log( _L("Position must be between 0 and 19( 0<= position <= 19 ).User Leaves here.") ); |
|
2230 User::Leave( KBadParameter ); |
|
2231 } |
|
2232 } |
|
2233 } |
|
2234 else |
|
2235 { |
|
2236 result = KBadParameter; |
|
2237 iLog->Log( _L("Pass in no parameter.User Leaves here.") ); |
|
2238 User::Leave( KBadParameter ); |
|
2239 } |
|
2240 iLog->Log( _L("<--Out of ContainerAt.") ); |
|
2241 return result; |
|
2242 } |
|
2243 // ----------------------------------------------------------------------------- |
|
2244 // CMetaDataDisplay::ContainerFieldIdAt |
|
2245 // CloseChunkData test method function. |
|
2246 // (other items were commented in a header). |
|
2247 // ----------------------------------------------------------------------------- |
|
2248 // |
|
2249 TInt CMetaDataDisplay::ContainerFieldIdAt( CStifItemParser& aItem ) |
|
2250 { |
|
2251 iLog->Log( _L("") );//A blank line makes the log file look better |
|
2252 iLog->Log( _L("Entering ContainerFieldIdAt-->") ); |
|
2253 TInt result( 0 ); |
|
2254 TInt position; |
|
2255 TInt paraError( aItem.GetNextInt( position ) ); |
|
2256 if( paraError == KErrNone ) |
|
2257 { |
|
2258 while( paraError == KErrNone ) |
|
2259 { |
|
2260 if( ( 0 <= position ) && ( position <= 19 ) ) |
|
2261 { |
|
2262 TMetaDataFieldId tempFieldId; |
|
2263 iContainer->FieldIdAt( position,tempFieldId ); |
|
2264 iLog->Log( _L("The meta data field that the position [%d] asociates with is [%d]."),position,tempFieldId ); |
|
2265 result = KErrNone; |
|
2266 paraError= aItem.GetNextInt( position ); |
|
2267 if( paraError != KErrNone ) |
|
2268 { |
|
2269 iLog->Log( _L("Pass in no parameter.Get out of the while-loop-clause here.") ); |
|
2270 break; |
|
2271 //User::Leave( KBadParameter ); |
|
2272 } |
|
2273 } |
|
2274 else |
|
2275 { |
|
2276 result = KBadParameter; |
|
2277 iLog->Log( _L("Position must be between 0 and 19( 0<= position <= 19 ).User Leaves here.") ); |
|
2278 User::Leave( KBadParameter ); |
|
2279 } |
|
2280 } |
|
2281 } |
|
2282 else |
|
2283 { |
|
2284 result = KBadParameter; |
|
2285 iLog->Log( _L("Pass in no parameter.User Leaves here.") ); |
|
2286 User::Leave( KBadParameter ); |
|
2287 } |
|
2288 iLog->Log( _L("<--Out of ContainerFieldIdAt.") ); |
|
2289 return result; |
|
2290 } |
|
2291 |
|
2292 // ----------------------------------------------------------------------------- |
|
2293 // CMetaDataDisplay::?member_function |
|
2294 // ?implementation_description |
|
2295 // (other items were commented in a header). |
|
2296 // ----------------------------------------------------------------------------- |
|
2297 // |
|
2298 /* |
|
2299 TInt CMetaDataDisplay::?member_function( |
|
2300 CItemParser& aItem ) |
|
2301 { |
|
2302 |
|
2303 ?code |
|
2304 |
|
2305 } |
|
2306 */ |
|
2307 |
|
2308 // ========================== OTHER EXPORTED FUNCTIONS ========================= |
|
2309 // None |
|
2310 |
|
2311 // [End of File] - Do not remove |