serviceproviders/sapi_mediamanagement/src/mgserviceobserver.cpp
changeset 33 50974a8b132e
parent 22 fc9cf246af83
equal deleted inserted replaced
32:8d692d9f828f 33:50974a8b132e
    14 * Description:  This Class is observer for the mgservice class (core class)
    14 * Description:  This Class is observer for the mgservice class (core class)
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 #include <liwcommon.h>
    18 #include <liwcommon.h>
    19 #include <mclfitemlistmodel.h>
    19 #include <MCLFItemListModel.h>
    20 
    20 
    21 #include "mgserviceobserver.h"
    21 #include "mgserviceobserver.h"
    22 #include "mgitemslist.h"
    22 #include "mgitemslist.h"
    23 #include "mginterface.h"
    23 #include "mginterface.h"
    24 #include "serviceerrno.h"
    24 #include "serviceerrno.h"
       
    25 #include "mgclfoperationobserver.h"
       
    26 
    25 //using namespace LIW;
    27 //using namespace LIW;
    26 //Output Keys/arguments
    28 //Output Keys/arguments
    27 _LIT8(KResponse,"ReturnValue");
    29 _LIT8(KResponse,"ReturnValue");
    28 _LIT8(KErrorCode,"ErrorCode");
    30 _LIT8(KErrorCode,"ErrorCode");
    29 
    31 
    50 // CMgServiceObserver::MgNotify
    52 // CMgServiceObserver::MgNotify
    51 // Called by CMgService class when asynch operation complete
    53 // Called by CMgService class when asynch operation complete
    52 // -----------------------------------------------------------------------------
    54 // -----------------------------------------------------------------------------
    53 void CMgServiceObserver :: MgNotifyL( TUint  aTransactionID,
    55 void CMgServiceObserver :: MgNotifyL( TUint  aTransactionID,
    54                                       MCLFItemListModel* aListModel,
    56                                       MCLFItemListModel* aListModel,
       
    57                                       CClfOperationObserver* aOperationObserver,
    55                                       TMgOperationEvent& aOperationEvent,
    58                                       TMgOperationEvent& aOperationEvent,
    56                                       const TInt& aError  )
    59                                       const TInt& aError  )
    57 
    60 
    58 
    61 
    59 	{
    62 	{
    96 
    99 
    97 	 	// Iterator will accept the cmd Id and iListmodel and
   100 	 	// Iterator will accept the cmd Id and iListmodel and
    98 	 	// it will become the owner of iListModel,Ownership of
   101 	 	// it will become the owner of iListModel,Ownership of
    99 	 	// Iterator is transfered to consumer
   102 	 	// Iterator is transfered to consumer
   100 
   103 
   101 	 	CMgItemsList *iterator = CMgItemsList::NewL( aListModel, iCmdId );
   104 	 	CMgItemsList *iterator = CMgItemsList::NewL( aListModel, aOperationObserver, iCmdId );
   102  	    CleanupStack::PushL( iterator );
   105  	    CleanupStack::PushL( iterator );
   103 	 	response.Set( iterator );
   106 	 	response.Set( iterator );
   104 		iOutput->AppendL( TLiwGenericParam ( KResponse, response ) );
   107 		iOutput->AppendL( TLiwGenericParam ( KResponse, response ) );
   105  		CleanupStack::Pop( iterator );
   108  		CleanupStack::Pop( iterator );
   106         iterator->DecRef();
   109         // iterator->DecRef();   //This code is commented because the when the iterator is passed to user by using 
       
   110                                  //AsIterable() call refCount is not getting increased. As the iterator control is 
       
   111  		                         //with the user we dont need to decrement the ref count here.
   107         }
   112         }
   108    	else
   113    	else
   109    	    {
   114    	    {
   110 		delete aListModel;
   115 		delete aListModel;
       
   116 		delete aOperationObserver;
   111 		aListModel = NULL;
   117 		aListModel = NULL;
       
   118 		aOperationObserver = NULL;
   112 	 	}
   119 	 	}
   113 
   120 
   114     if( NULL != iCallBack )
   121     if( NULL != iCallBack )
   115      	{
   122      	{
   116     	// call callback of consumer
   123     	// call callback of consumer