sapi_mediamanagement/tsrc/dev/tmediamgmttest/src/mediamgmtblocks.cpp
changeset 0 14df0fbfcc4e
equal deleted inserted replaced
-1:000000000000 0:14df0fbfcc4e
       
     1 /*
       
     2 * Copyright (c) 2002 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 the License "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:   ?Description
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 // INCLUDE FILES
       
    22 #include <e32svr.h>
       
    23 #include <StifParser.h>
       
    24 #include <Stiftestinterface.h>
       
    25 #include  <utf.h>
       
    26 #include "MediaMgmt.h"
       
    27 #include "mgitemslist.h"
       
    28 using namespace LIW;
       
    29 
       
    30 
       
    31 _LIT8(KResponse,"Response");
       
    32 _LIT8(KErrorCode,"ErrorCode");
       
    33 
       
    34 _LIT8( KMgNull8, "NULL" );
       
    35 _LIT16( KMgNull, "NULL");
       
    36 _LIT(KTimeFormat,"%F%M/%D/%Y/%H:%T");
       
    37 
       
    38 
       
    39 // EXTERNAL DATA STRUCTURES
       
    40 //extern  ?external_data;
       
    41 
       
    42 // EXTERNAL FUNCTION PROTOTYPES
       
    43 //extern ?external_function( ?arg_type,?arg_type );
       
    44 
       
    45 // CONSTANTS
       
    46 //const ?type ?constant_var = ?constant;
       
    47 
       
    48 // MACROS
       
    49 //#define ?macro ?macro_def
       
    50 
       
    51 // LOCAL CONSTANTS AND MACROS
       
    52 //const ?type ?constant_var = ?constant;
       
    53 //#define ?macro_name ?macro_def
       
    54 
       
    55 // MODULE DATA STRUCTURES
       
    56 //enum ?declaration
       
    57 //typedef ?declaration
       
    58 
       
    59 // LOCAL FUNCTION PROTOTYPES
       
    60 //?type ?function_name( ?arg_type, ?arg_type );
       
    61 
       
    62 // FORWARD DECLARATIONS
       
    63 //class ?FORWARD_CLASSNAME;
       
    64 
       
    65 // ============================= LOCAL FUNCTIONS ===============================
       
    66 
       
    67 // -----------------------------------------------------------------------------
       
    68 // ?function_name ?description.
       
    69 // ?description
       
    70 // Returns: ?value_1: ?description
       
    71 //          ?value_n: ?description_line1
       
    72 //                    ?description_line2
       
    73 // -----------------------------------------------------------------------------
       
    74 //
       
    75 /*
       
    76 ?type ?function_name(
       
    77     ?arg_type arg,  // ?description
       
    78     ?arg_type arg)  // ?description
       
    79     {
       
    80 
       
    81     ?code  // ?comment
       
    82 
       
    83     // ?comment
       
    84     ?code
       
    85     }
       
    86 */
       
    87 
       
    88 // ============================ MEMBER FUNCTIONS ===============================
       
    89 
       
    90 // -----------------------------------------------------------------------------
       
    91 // CMediaMgmt::Delete
       
    92 // Delete here all resources allocated and opened from test methods.
       
    93 // Called from destructor.
       
    94 // -----------------------------------------------------------------------------
       
    95 //
       
    96 void CMediaMgmt::Delete()
       
    97     {
       
    98 
       
    99     }
       
   100 
       
   101 // -----------------------------------------------------------------------------
       
   102 // CMediaMgmt::RunMethodL
       
   103 // Run specified method. Contains also table of test mothods and their names.
       
   104 // -----------------------------------------------------------------------------
       
   105 //
       
   106 TInt CMediaMgmt::RunMethodL(
       
   107     CStifItemParser& aItem )
       
   108     {
       
   109 
       
   110     static TStifFunctionInfo const KFunctions[] =
       
   111         {
       
   112         // Copy this line for every implemented function.
       
   113         // First string is the function name used in TestScripter script file.
       
   114         // Second is the actual implementation member function.
       
   115         ENTRY( "GetFiles", CMediaMgmt::GetFilesL ),
       
   116         ENTRY( "GetFilesInfo", CMediaMgmt::GetFilesInfoL ),
       
   117 
       
   118         };
       
   119 
       
   120     const TInt count = sizeof( KFunctions ) /
       
   121                         sizeof( TStifFunctionInfo );
       
   122 
       
   123     return RunInternalL( KFunctions, count, aItem );
       
   124 
       
   125     }
       
   126 
       
   127 // -----------------------------------------------------------------------------
       
   128 // CMediaMgmt::ExampleL
       
   129 // Example test method function.
       
   130 // (other items were commented in a header).
       
   131 // -----------------------------------------------------------------------------
       
   132 //
       
   133 TInt CMediaMgmt::GetFilesL( CStifItemParser& aItem )
       
   134     {
       
   135     _LIT( KExample, "In GetFilesL" );
       
   136     iLog->Log( KExample );
       
   137 	struct ParamPass* arg1 = new ParamPass();
       
   138     arg1->it = &aItem;  // Just stoing into global variables so that it can be used by thread
       
   139     arg1->log = iLog;  //  function
       
   140     arg1->CmdId = EMgGetFiles ;  // Command For Get Files
       
   141 
       
   142 	TRequestStatus Status = KRequestPending  ;
       
   143 	RThread FunctionThread ;
       
   144 
       
   145     //creating the thread , this thread is reponsible for sending the request to SAPI
       
   146     TInt ret = FunctionThread.Create( _L("FunctionThread"), ThreadFunction ,KDefaultStackSize ,
       
   147     						NULL ,( TAny * ) arg1);
       
   148 
       
   149     User::LeaveIfError(ret);
       
   150     FunctionThread.Logon(Status);
       
   151     FunctionThread.Resume() ;
       
   152 
       
   153     // Waiting for thread to die in other words we make asynch call to synch call :-))
       
   154     User :: WaitForRequest (Status)	;
       
   155 
       
   156 
       
   157     FunctionThread.Close();
       
   158 
       
   159     delete arg1;
       
   160 	return Status.Int() ;
       
   161    }
       
   162 
       
   163 
       
   164 // -----------------------------------------------------------------------------
       
   165 // CMediaMgmt::ExampleL
       
   166 // Example test method function.
       
   167 // (other items were commented in a header).
       
   168 // -----------------------------------------------------------------------------
       
   169 //
       
   170 TInt CMediaMgmt::GetFilesInfoL( CStifItemParser& aItem )
       
   171     {
       
   172     _LIT( KExample, "In GetFilesInfoL" );
       
   173     iLog->Log( KExample );
       
   174 
       
   175     struct ParamPass* arg1 = new ParamPass();
       
   176     arg1->it = &aItem;  // Just stoing into global variables so that it can be used by thread
       
   177     arg1->log = iLog;  //  function
       
   178     arg1->CmdId = EMgGetFilesInfo ;  // Command For Get Files Info
       
   179 
       
   180 	TRequestStatus Status = KRequestPending  ;
       
   181 	RThread FunctionThread ;
       
   182 
       
   183     //creating the thread , this thread is reponsible for sending the request to SAPI
       
   184     TInt ret = FunctionThread.Create( _L("FunctionThread"), ThreadFunction ,KDefaultStackSize ,
       
   185     						NULL ,( TAny * ) arg1);
       
   186 
       
   187     User::LeaveIfError(ret);
       
   188     FunctionThread.Logon(Status);
       
   189     FunctionThread.Resume() ;
       
   190 
       
   191     // Waiting for thread to die in other words we make asynch call to synch call :-))
       
   192     User :: WaitForRequest (Status)	;
       
   193 
       
   194     FunctionThread.Close();
       
   195 
       
   196     delete arg1;
       
   197 	return Status.Int() ;
       
   198 
       
   199     }
       
   200 
       
   201 
       
   202 
       
   203 // -----------------------------------------------------------------------------
       
   204 // Callback:: MgNotify
       
   205 // Call Back Function Called by the Media Management SAPIin Iteration 1
       
   206 // -----------------------------------------------------------------------------
       
   207 //
       
   208 
       
   209 
       
   210  void Callback::MgNotifyL(TUint /*aTransactionID*/,
       
   211                                MCLFItemListModel*  aListModel,
       
   212         					   TMgOperationEvent& aOperationEvent,
       
   213                                const TInt& aError )
       
   214 
       
   215 
       
   216 	{
       
   217 
       
   218     CLiwGenericParamList* output = CLiwGenericParamList::NewL();
       
   219     CLiwGenericParamList* input = CLiwGenericParamList::NewL();
       
   220     CleanupStack::PushL(output);
       
   221     CleanupStack::PushL(input);
       
   222 	// Fill the Error code Inside Generic Param List
       
   223 	TLiwVariant errCode;
       
   224     errCode.Set( aError );
       
   225 	TLiwGenericParam errTypeParam( KErrorCode, errCode );
       
   226 	output->AppendL( errTypeParam );
       
   227 
       
   228 	// if not error create the iterator class and put it into output list
       
   229 	if(  KErrNone == aError   )
       
   230      	{
       
   231         // Fill the Iterator in Generic Paaram List
       
   232         TLiwVariant response;
       
   233 
       
   234 	 	// Iterator will accept the cmd Id and iListmodel and
       
   235 	 	// it will become the owner of iListModel,Ownership of
       
   236 	 	// Iterator is transfered to consumer
       
   237 
       
   238 	 	CMgItemsList *iterator = CMgItemsList::NewL( aListModel, arg->CmdId  );
       
   239 
       
   240 
       
   241 	 	response.Set( iterator );
       
   242 	 	TLiwGenericParam responseTypeParam( KResponse, response );
       
   243  		output->AppendL( responseTypeParam );
       
   244 
       
   245         }
       
   246    	else
       
   247    	    {
       
   248 		delete aListModel;
       
   249 		aListModel = NULL;
       
   250 	 	}
       
   251 
       
   252 
       
   253     	// call callback of consumer
       
   254     	if( KErrNone ==  aError   )
       
   255     	    {
       
   256     	    HandleNotifyL ( 0, KLiwEventCompleted, *output,*input );
       
   257     	    }
       
   258         else
       
   259             {
       
   260             HandleNotifyL ( 0, KLiwEventError, *output,*input );
       
   261             }
       
   262 
       
   263   	CleanupStack::PopAndDestroy();
       
   264   	CleanupStack::PopAndDestroy();
       
   265 
       
   266 
       
   267 
       
   268 	}
       
   269 
       
   270 
       
   271 
       
   272 
       
   273 
       
   274 
       
   275 // -----------------------------------------------------------------------------
       
   276 // Callback:: HandleNotifyL
       
   277 // Call Back Function Called by the Media Management SAPI.in Iteration 2
       
   278 // -----------------------------------------------------------------------------
       
   279 //
       
   280 
       
   281 
       
   282 
       
   283 TInt Callback:: HandleNotifyL(TInt aCmdId,TInt aEventId,CLiwGenericParamList& aOutParamList,const CLiwGenericParamList& aInParamList)
       
   284 {
       
   285 
       
   286    arg->log->Log(_L("Enter in Handle notify"));
       
   287 	if ( KLiwEventStarted == aEventId )
       
   288 	{
       
   289 		// Asynchronous request started
       
   290 	}
       
   291 	else if ( KLiwEventCanceled == aEventId )
       
   292 	{
       
   293 		// Asynchronous event canceled
       
   294 		arg->returnCode = KErrCancel;
       
   295 		CActiveScheduler :: Stop() ;
       
   296 		return 0;
       
   297 	}
       
   298 	else
       
   299 	{
       
   300 
       
   301 	TInt32 ErrCode;
       
   302 	CLiwIterable* iIterable;
       
   303 	TLiwVariant Map;
       
   304 	const CLiwMap* MetaData;
       
   305 	TInt pos = 0;
       
   306 	//TBuf<200> aValue1[20][20]; // Hemae : very large value for stack
       
   307 	TInt no_of_maps;
       
   308 
       
   309 	// Traiverse the List and Fill in the Log Files
       
   310 	const TLiwGenericParam* p = aOutParamList.FindFirst(pos, KErrorCode); // Finding Error Code
       
   311 	if(p)
       
   312 	{
       
   313 		ErrCode = p->Value().AsTInt32();
       
   314 		//arg->log->Log(_L("Got error Code"));
       
   315 	}
       
   316 	else
       
   317 	{
       
   318 		arg->log->Log(_L(" Not able to Find the Error Code "));
       
   319 		arg->returnCode = KErrGeneral;
       
   320 		CActiveScheduler :: Stop() ;
       
   321 		return 0;
       
   322 		//User::Exit( KErrGeneral );
       
   323 	}
       
   324 
       
   325 	if(ErrCode < 0 ) // If any error comes in MG SAPI
       
   326 	{
       
   327 		arg->log->Log(_L(" Error Occured in SAPI = %d"),ErrCode);
       
   328 		arg->returnCode = KErrGeneral;
       
   329 		CActiveScheduler :: Stop() ;
       
   330 		return 0;
       
   331 		//User::Exit( KErrGeneral );
       
   332 	}
       
   333 
       
   334 	p = aOutParamList.FindFirst(pos, KResponse);// Finding out the response of Media Management
       
   335 	if(!p)
       
   336 	{
       
   337 		arg->log->Log(_L(" Not able to Find the Response "));
       
   338 		arg->returnCode = KErrGeneral;
       
   339 		CActiveScheduler :: Stop() ;
       
   340 		return 0;
       
   341 		//User::Exit( KErrGeneral );
       
   342 	}
       
   343 	else
       
   344 	{
       
   345 	    //arg->log->Log(_L(" Got the Response "));
       
   346 		iIterable = p->Value().AsIterable();// returning Iterator as Response
       
   347 		TBuf8<30> Key;// Key In The Map
       
   348 		TPtrC KeyValue;// value of that key
       
   349 		TLiwVariant val;//just for extracting the value
       
   350 		//-----------Loop for Iterator -------------------------------//
       
   351 		TBuf<200> Output;
       
   352 		int count =0;
       
   353 		TBuf<30> string;
       
   354         TBuf<20> StringTime;
       
   355         TInt i;
       
   356         TInt value;
       
   357         TTime time;
       
   358         TPtrC temp;
       
   359 		while(iIterable->NextL(Map))// Find the next value from Iterator
       
   360 		{
       
   361 
       
   362 			Output.Copy(_L("File"));
       
   363 			arg->log->Log(Output);
       
   364 			MetaData = Map.AsMap();// Iterator return the map which contains meta data
       
   365 			Output.Copy(_L("key"));
       
   366 			Output.Append(_L("							"));
       
   367 			Output.Append(_L("KeyValue"));
       
   368 			arg->log->Log(Output);
       
   369 
       
   370 			for(i = 0 ; i <MetaData->Count(); i++ )
       
   371 			{
       
   372 
       
   373 				MetaData->AtL(i,Key);
       
   374 				MetaData->FindL(Key, val);
       
   375 				Output.Copy(Key);
       
   376 		    	Output.Append(_L("            "));
       
   377 				if(EVariantTypeTInt32==val.TypeId())
       
   378 				{
       
   379 					value = val.AsTInt32();
       
   380 					string.Delete(0,string.Length());
       
   381 					string.AppendNum(value);
       
   382 					//aValue1[count][i] = string;
       
   383 					Output.Append(string);
       
   384 				}
       
   385 				else if(EVariantTypeTTime==val.TypeId())
       
   386 				{
       
   387 					time = val.AsTTime();
       
   388 					//dheeraj clear
       
   389 					time.FormatL(StringTime, KTimeFormat);
       
   390 					//aValue1[count][i] = StringTime;
       
   391 					Output.Append(StringTime);
       
   392                     // date format : 5/25/2005 12:40"
       
   393 				}
       
   394 				else
       
   395 				{
       
   396 					val.Get(KeyValue);
       
   397 					temp.Set( val.AsDes() );
       
   398 					//aValue1[count][i] = temp ;
       
   399 					Output.Append(KeyValue);
       
   400 				}
       
   401 
       
   402 				arg->log->Log(Output); // printing Key Values in log files
       
   403 
       
   404 			}
       
   405 			count++;
       
   406 		}
       
   407 
       
   408 		/*arg->it->GetNextInt(no_of_maps);
       
   409 		TPtrC expected_out[no_of_maps][20];
       
   410 		switch (arg->meta)
       
   411 		{
       
   412 			case 1:
       
   413 					TInt row,col;
       
   414 					for (row=0; row <no_of_maps; row++)
       
   415         			for (col=0 ;col<8;col++)
       
   416         			arg->it->GetNextString(expected_out[row][col]);
       
   417         			for (TInt i=0; i < row ; i++)
       
   418 				    for (TInt j=0; j<col ; j++)
       
   419 				    if (expected_out[i][j].CompareF(aValue1[i][j])!=0)
       
   420 				 	User::Exit( KErrArgument );
       
   421        				break;
       
   422 
       
   423 			case 2: ;
       
   424 
       
   425 
       
   426 		}*/
       
   427 
       
   428 
       
   429     }
       
   430 	//------Loop for Iterator-----------------------------------------//
       
   431      arg->returnCode = KErrNone;
       
   432 	CActiveScheduler :: Stop() ;
       
   433 	return KErrNone;
       
   434  	}
       
   435 
       
   436 }
       
   437 
       
   438 // -----------------------------------------------------------------------------
       
   439 // Thread Function For Sending the Asynch request to Media Management SAPI
       
   440 // -----------------------------------------------------------------------------
       
   441 //
       
   442 
       
   443 TInt ThreadFunction (TAny *a)
       
   444 {
       
   445 	// Creating the Cleanup stack for this new thread
       
   446 	 CTrapCleanup* cleanup = CTrapCleanup::New();
       
   447 	 struct ParamPass* arg1 = (ParamPass*) a;
       
   448 	 TInt errorCode;
       
   449 	 TInt error = KErrNone;
       
   450 	 TRAP(error, errorCode = GetFilesAsynchL(a));
       
   451 	 delete cleanup;
       
   452 	 if(error == KErrNone)
       
   453 	 {
       
   454 	 	if(errorCode<0)
       
   455 	 	{
       
   456 	 	  arg1->log->Log(_L(" Error in input "));
       
   457 	 	  TBuf<30> string;
       
   458 		  string.AppendNum(errorCode);
       
   459 		  arg1->log->Log(string);
       
   460 		  // Hema : check here if the case is neagative or postive
       
   461 		  // then return proper error code
       
   462 		  return KErrNone;
       
   463 
       
   464 	 	}
       
   465 	 	else
       
   466 	 	{
       
   467 	 	   return  KErrNone;
       
   468 	 	}
       
   469 
       
   470 	 }
       
   471 
       
   472 	 return KErrGeneral;
       
   473 }
       
   474 
       
   475 
       
   476 
       
   477 
       
   478 TInt GetFilesAsynchL( TAny *a)
       
   479 {
       
   480 	TPtrC FileType16;
       
   481 	TPtrC FilterField16;
       
   482 	TPtrC StartVal;
       
   483 	TPtrC EndVal;
       
   484 	TPtrC SortField16;
       
   485 	TInt order = 0;
       
   486 
       
   487 	struct ParamPass *arg1 = (ParamPass *)a;
       
   488 
       
   489 	arg1->log = CStifLogger::NewL( KMediaMgmtLogPath,
       
   490                           KResultFile,
       
   491                           CStifLogger::ETxt,
       
   492                           CStifLogger::EFile,
       
   493                           ETrue );
       
   494 
       
   495 
       
   496 
       
   497     // Get All the Values From CFG
       
   498     if( arg1->it->GetNextString ( FileType16 ) != KErrNone )
       
   499         {
       
   500         arg1->log->Log(_L(" Failed to Get the File Type ") );
       
   501         return KErrGeneral;
       
   502         }
       
   503 	if( arg1->it->GetNextString ( FilterField16 ) != KErrNone )
       
   504         {
       
   505         arg1->log->Log(_L("Failed to Get the Filter Field of File ")) ;
       
   506         return KErrGeneral;
       
   507         }
       
   508     if( arg1->it->GetNextString ( StartVal ) != KErrNone )
       
   509         {
       
   510         arg1->log->Log(_L("Failed to Get the start value of Filter ")) ;
       
   511         return KErrGeneral;
       
   512         }
       
   513 	if( arg1->it->GetNextString ( EndVal ) != KErrNone )
       
   514         {
       
   515         arg1->log->Log(_L("Failed to Get the End Value of Filter ")) ;
       
   516         return KErrGeneral;
       
   517         }
       
   518     if( arg1->it->GetNextString ( SortField16 ) != KErrNone )
       
   519         {
       
   520         arg1->log->Log(_L("Failed to Get the Sort Filed  ")) ;
       
   521         return KErrGeneral;
       
   522         }
       
   523 
       
   524 	if( arg1->it->GetNextInt(order) != KErrNone )
       
   525         {
       
   526         arg1->log->Log(_L("Failed to Get the Sorting Order ")) ;
       
   527         return KErrGeneral;
       
   528         }
       
   529 
       
   530      	if (!FileType16.Compare(_L("Image")) || !FileType16.Compare(_L("Sound")))
       
   531 
       
   532      	arg1->meta = 1;
       
   533 
       
   534 
       
   535         // the below section for giving header to log files
       
   536 
       
   537      	TBuf<200> TestCase;
       
   538 
       
   539      	TestCase.Copy(_L("FileType "));
       
   540      	TestCase.Append(_L("   "));
       
   541 
       
   542        	TestCase.Append(_L("FilterField"));
       
   543      	TestCase.Append(_L("   "));
       
   544 
       
   545 
       
   546      	TestCase.Append(_L("StartVal"));
       
   547      	TestCase.Append(_L("   "));
       
   548 
       
   549 
       
   550      	TestCase.Append(_L("EndVal"));
       
   551      	TestCase.Append(_L("   "));
       
   552 
       
   553 
       
   554      	TestCase.Append(_L("SortField"));
       
   555      	TestCase.Append(_L("   "));
       
   556 
       
   557 
       
   558        	TestCase.Append(_L("order"));
       
   559      	TestCase.Append(_L("   "));
       
   560 
       
   561 
       
   562 
       
   563      	arg1->log->Log(TestCase);
       
   564 
       
   565      	TestCase.Copy(FileType16);
       
   566      	TestCase.Append(_L("   "));
       
   567 
       
   568        	TestCase.Append(FilterField16);
       
   569      	TestCase.Append(_L("   "));
       
   570 
       
   571 
       
   572      	TestCase.Append(StartVal);
       
   573      	TestCase.Append(_L("   "));
       
   574 
       
   575 
       
   576      	TestCase.Append(EndVal);
       
   577      	TestCase.Append(_L("   "));
       
   578 
       
   579 
       
   580      	TestCase.Append(SortField16);
       
   581      	TestCase.Append(_L("   "));
       
   582 
       
   583         if( 0 != order)
       
   584        	TestCase.Append(_L("Descending"));
       
   585         else
       
   586         TestCase.Append(_L("Ascending"));
       
   587 
       
   588      	TestCase.Append(_L("   "));
       
   589 
       
   590      	arg1->log->Log(TestCase);
       
   591 
       
   592 
       
   593          // Convert 16 Bit values into 8 bit as SAPI accept 8 bit Des
       
   594         TBuf8<30> FileType ;
       
   595         FileType.Copy(FileType16);
       
   596 
       
   597         TBuf8<30> FilterField ;
       
   598         FilterField.Copy(FilterField16);
       
   599 
       
   600         TBuf8<30> SortField ;
       
   601         SortField.Copy(SortField16);
       
   602 
       
   603 
       
   604 
       
   605 	//Create the object of callback
       
   606 	MMgOperationObserver*  aCallBack = new (ELeave) Callback(arg1);
       
   607 	CleanupStack::PushL(aCallBack);
       
   608 
       
   609 	// Start Scheduler
       
   610 	CActiveScheduler *Scheduler = new CActiveScheduler ;
       
   611 	CActiveScheduler :: Install(Scheduler) ;
       
   612 	CleanupStack::PushL(Scheduler);
       
   613 
       
   614     // Create the Instance of SAPI core class and
       
   615     //the Input Param and output Param
       
   616     CMgService* CoreObj = CMgService ::NewL() ;
       
   617 	CleanupStack::PushL(CoreObj);
       
   618 
       
   619 //------- New Code Added ---------------------------------------------------//
       
   620 TMgServiceRequest reqArgument;
       
   621 
       
   622 
       
   623 if( 0 != FileType.CompareF( KMgNull8 ) )
       
   624     reqArgument.iFileType.Set( FileType );
       
   625 
       
   626 
       
   627 if( 0 != FilterField.CompareF( KMgNull8 ) )
       
   628     reqArgument.iFilterField.Set( FilterField );
       
   629 
       
   630 if( 0 != StartVal.CompareF( KMgNull ) )
       
   631     reqArgument.iStartVal.Set( StartVal );
       
   632 
       
   633 if( 0 != EndVal.CompareF( KMgNull ) )
       
   634     reqArgument.iEndVal.Set( EndVal );
       
   635 
       
   636 if( 0 != SortField.CompareF( KMgNull8 ) )
       
   637     reqArgument.iSortField.Set( SortField );
       
   638 
       
   639 if( 0 != order)
       
   640 {
       
   641     reqArgument.iOrder.Set( _L8("Descending") );
       
   642 }
       
   643 
       
   644 
       
   645 
       
   646 //--------------------------------------------------------------------------//
       
   647 
       
   648 
       
   649 
       
   650 
       
   651 	TInt retcode = 0;
       
   652 
       
   653 	// Calling SAPI :-)))
       
   654 
       
   655 
       
   656      	 TRAP( retcode , CoreObj->GetListL(reqArgument ,aCallBack) );
       
   657 
       
   658 
       
   659     if(retcode < 0)
       
   660     {
       
   661 
       
   662 
       
   663 	CleanupStack::PopAndDestroy();//Remove callback
       
   664 	CleanupStack::PopAndDestroy();//Remove scheduler
       
   665 	CleanupStack::PopAndDestroy();//Remove core object
       
   666     return retcode;
       
   667 
       
   668     }
       
   669 
       
   670     CActiveScheduler :: Start() ;
       
   671 
       
   672     CleanupStack::PopAndDestroy();//Remove callback
       
   673 	CleanupStack::PopAndDestroy();//Remove scheduler
       
   674 	CleanupStack::PopAndDestroy();//Remove core object
       
   675 
       
   676     return arg1->returnCode;
       
   677 }
       
   678