serviceproviders/sapi_mediamanagement/src/mginterface.cpp
changeset 22 fc9cf246af83
parent 19 989d2f495d90
equal deleted inserted replaced
19:989d2f495d90 22:fc9cf246af83
   123 // -----------------------------------------------------------------------------
   123 // -----------------------------------------------------------------------------
   124 CMgInterface::~CMgInterface()
   124 CMgInterface::~CMgInterface()
   125 	{
   125 	{
   126 
   126 
   127     //Release the instance of service observer class
   127     //Release the instance of service observer class
   128     delete iServiceObserver;
   128   //  delete iServiceObserver;
   129     iServiceObserver = NULL;
   129    // iServiceObserver = NULL;
   130 
   130 
   131 	//Release the instance of core class
   131 	//Release the instance of core class
   132     delete iCoreClass;
   132     delete iCoreClass;
   133 	iCoreClass = NULL;
   133 	iCoreClass = NULL;
   134 
   134 
   253 
   253 
   254 			    if( ( 0 == dsName.CompareF( KFileInfo )  )
   254 			    if( ( 0 == dsName.CompareF( KFileInfo )  )
   255 				    || ( 0 == dsName.CompareF( KFile ) )  )
   255 				    || ( 0 == dsName.CompareF( KFile ) )  )
   256 				    {
   256 				    {
   257 				// check if core class ready to accept request
   257 				// check if core class ready to accept request
   258 			    	if( EMgFree == iCoreClass->State() )
   258 			    /*	if( EMgFree == iCoreClass->State() )
   259 					    {
   259 					    {*/
   260 					    if( aCmdOptions & KLiwOptASyncronous ) //Asynchronous request
   260 					    if( aCmdOptions & KLiwOptASyncronous ) //Asynchronous request
   261 						    {
   261 						    {
   262 						    if( NULL != aCallBack ) // Asynchronous call
   262 						    if( NULL != aCallBack ) // Asynchronous call
   263 								{
   263 								{
   264 								transactionID = aCallBack->GetTransactionID();
   264 								transactionID = aCallBack->GetTransactionID();
   265 								if( 0 == dsName.CompareF( KFileInfo ) )
       
   266 									{
       
   267 								    iServiceObserver->SetMemberVar( EMgGetFilesInfo,
       
   268 									NULL,aCallBack );
       
   269 									}
       
   270 								else
       
   271 									{
       
   272 								    iServiceObserver->SetMemberVar( EMgGetFiles,
       
   273 									NULL,aCallBack );
       
   274 									}
       
   275 
       
   276 							   	 //Sending request to core class
   265 							   	 //Sending request to core class
   277 							     TRAP (errCode,SendRequestL( aInParamList , transactionID ,postionbasedsearching ));
   266 							     TRAP (errCode,SendRequestL( aInParamList , transactionID ,postionbasedsearching,aCallBack ));
   278 
   267 
   279 						        }
   268 						        }
   280 							else		//Callback  missing
   269 							else		//Callback  missing
   281 								{
   270 								{
   282 								AppendErrorMessageL( aCmdName, KNullDesC8, KInvalidAsyncParam );
   271 								AppendErrorMessageL( aCmdName, KNullDesC8, KInvalidAsyncParam );
   289 						    //synch request currently not supported
   278 						    //synch request currently not supported
   290 						    AppendErrorMessageL( aCmdName, KNullDesC8, KInvalidAsyncParam );
   279 						    AppendErrorMessageL( aCmdName, KNullDesC8, KInvalidAsyncParam );
   291 						    errCode = KErrNotFound;
   280 						    errCode = KErrNotFound;
   292 							}//synchronous request
   281 							}//synchronous request
   293 
   282 
   294 						}//Sapi status
   283 						/*}//Sapi status
   295 				    else
   284 				    else
   296 				        {
   285 				        {
   297 				        AppendErrorMessageL( aCmdName, KNullDesC8, KServerBusy );
   286 				        AppendErrorMessageL( aCmdName, KNullDesC8, KServerBusy );
   298 				        errCode = KErrServerBusy;
   287 				        errCode = KErrServerBusy;
   299 				        }
   288 				        }*/
   300 
   289 
   301 					}//Data Source support
   290 					}//Data Source support
   302 				else
   291 				else
   303 				    {
   292 				    {
   304 				    //Incorrect Data source
   293 				    //Incorrect Data source
   376 // CMgInterface::CMgInterface
   365 // CMgInterface::CMgInterface
   377 // Constructor  of class
   366 // Constructor  of class
   378 // -----------------------------------------------------------------------------
   367 // -----------------------------------------------------------------------------
   379 
   368 
   380 CMgInterface::CMgInterface()
   369 CMgInterface::CMgInterface()
   381              :iCoreClass( NULL ),
   370              :iCoreClass( NULL )
   382 			  iServiceObserver( NULL )
   371 			
   383 	{
   372 	{
   384 	
   373 	
   385 	}
   374 	}
   386 
   375 
   387 
   376 
   394 	{
   383 	{
   395 	// Create the instance of core class
   384 	// Create the instance of core class
   396 	iCoreClass = CMgService::NewL();
   385 	iCoreClass = CMgService::NewL();
   397 
   386 
   398 	//Create the instance of service observer class
   387 	//Create the instance of service observer class
   399 	iServiceObserver = CMgServiceObserver::NewL();
   388 	//iServiceObserver = CMgServiceObserver::NewL();
   400 
   389 
   401 	}
   390 	}
   402 
   391 
   403 
   392 
   404 
   393 
   405 // -----------------------------------------------------------------------------
   394 // -----------------------------------------------------------------------------
   406 // CMgInterface::SendRequestL
   395 // CMgInterface::SendRequestL
   407 // This function will send the request to Core class
   396 // This function will send the request to Core class
   408 // -----------------------------------------------------------------------------
   397 // -----------------------------------------------------------------------------
   409 
   398 
   410 void CMgInterface::SendRequestL(const CLiwGenericParamList& aInParamList , TUint aTransactionID , TBool aPostionBasedSearching )
   399 void CMgInterface::SendRequestL(const CLiwGenericParamList& aInParamList , TUint aTransactionID , TBool aPostionBasedSearching , MLiwNotifyCallback* aCallBack)
   411 
   400 
   412 	{
   401 	{
   413 	TInt   pos=0;
   402 	TInt   pos=0;
   414 	const CLiwMap* filter = NULL;
   403 	const CLiwMap* filter = NULL;
   415     const CLiwMap* sorting = NULL;
   404     const CLiwMap* sorting = NULL;
   651 	            }
   640 	            }
   652 
   641 
   653 	    }//sort map
   642 	    }//sort map
   654 
   643 
   655 
   644 
   656 	 iCoreClass->GetListL( requestParam,iServiceObserver ) ;
   645 	// Need to give seperate observer for each call
   657 	 
   646 	
       
   647 	// Creating instance of serviceobserver for back to back callback support
       
   648 	
       
   649 	CMgServiceObserver* serviceObserver = CMgServiceObserver::NewL();
       
   650 	CleanupStack::PushL(serviceObserver);
       
   651 	// For supporting back to back callback 
       
   652 	serviceObserver->SetMemberVar( EMgBlankCmdId,
       
   653      NULL,aCallBack );
       
   654 	
       
   655 	 iCoreClass->GetListL( requestParam,serviceObserver ) ;
       
   656 	 CleanupStack::Pop(serviceObserver); 
   658 	 
   657 	 
   659 	 
   658 	 
   660 	  //Sorting is an optional parameter, if it is present only then sorting fields and order present in stack
   659 	  //Sorting is an optional parameter, if it is present only then sorting fields and order present in stack
   661     if( (param) &&  sorting )
   660     if( (param) &&  sorting )
   662         {
   661         {