mtpfws/mtpfw/dataproviders/proxydp/src/cmtpdeleteobject.cpp
changeset 49 c20dd21d1eb4
parent 20 6e82ae192c3a
child 60 841f70763fbe
equal deleted inserted replaced
41:2c19c7cf5550 49:c20dd21d1eb4
    29 #include "cmtpstoragemgr.h"
    29 #include "cmtpstoragemgr.h"
    30 #include "mtpproxydppanic.h"
    30 #include "mtpproxydppanic.h"
    31 #include "rmtpframework.h"
    31 #include "rmtpframework.h"
    32 #include "cmtpobjectbrowser.h"
    32 #include "cmtpobjectbrowser.h"
    33 #include "mtpdppanic.h"
    33 #include "mtpdppanic.h"
    34 
    34 #include "OstTraceDefinitions.h"
    35 __FLOG_STMT( _LIT8( KComponent,"PrxyDelObj" ); )
    35 #ifdef OST_TRACE_COMPILER_IN_USE
       
    36 #include "cmtpdeleteobjectTraces.h"
       
    37 #endif
       
    38 
       
    39 
    36 const TUint KInvalidDpId = 0xFF;
    40 const TUint KInvalidDpId = 0xFF;
    37 
    41 
    38 /**
    42 /**
    39 Verification data for the DeleteObject request
    43 Verification data for the DeleteObject request
    40 */
    44 */
    61 /**
    65 /**
    62 Destructor
    66 Destructor
    63 */    
    67 */    
    64 CMTPDeleteObject::~CMTPDeleteObject()
    68 CMTPDeleteObject::~CMTPDeleteObject()
    65     {
    69     {
       
    70     OstTraceFunctionEntry0( CMTPDELETEOBJECT_CMTPDELETEOBJECT_DES_ENTRY );
    66     iSingletons.Close();
    71     iSingletons.Close();
    67     iTargetDps.Close();
    72     iTargetDps.Close();
    68     iHandles.Close();
    73     iHandles.Close();
    69     delete iObjBrowser;
    74     delete iObjBrowser;
    70     
    75     OstTraceFunctionExit0( CMTPDELETEOBJECT_CMTPDELETEOBJECT_DES_EXIT );
    71     __FLOG( _L8("+/-Dtor") );
       
    72     __FLOG_CLOSE;
       
    73     }
    76     }
    74 
    77 
    75 /**
    78 /**
    76 Constructor
    79 Constructor
    77 */    
    80 */    
    78 CMTPDeleteObject::CMTPDeleteObject(MMTPDataProviderFramework& aFramework, MMTPConnection& aConnection) :
    81 CMTPDeleteObject::CMTPDeleteObject(MMTPDataProviderFramework& aFramework, MMTPConnection& aConnection) :
    79     CMTPRequestProcessor(aFramework, aConnection, sizeof(KMTPDeleteObjectPolicy)/sizeof(TMTPRequestElementInfo), KMTPDeleteObjectPolicy),
    82     CMTPRequestProcessor(aFramework, aConnection, sizeof(KMTPDeleteObjectPolicy)/sizeof(TMTPRequestElementInfo), KMTPDeleteObjectPolicy),
    80     iDeletedObjectsNumber(0)
    83     iDeletedObjectsNumber(0)
    81     {
    84     {
    82     __FLOG_OPEN( KMTPSubsystem, KComponent );
    85 
    83     __FLOG( _L8("+/-Ctor") );
       
    84     }
    86     }
    85     
    87     
    86 /**
    88 /**
    87 Second phase constructor.
    89 Second phase constructor.
    88 */
    90 */
    89 void CMTPDeleteObject::ConstructL()
    91 void CMTPDeleteObject::ConstructL()
    90     {
    92     {
    91     __FLOG( _L8("+ConstructL") );
    93     OstTraceFunctionEntry0( CMTPDELETEOBJECT_CONSTRUCTL_ENTRY );    
    92     
       
    93     iSingletons.OpenL();
    94     iSingletons.OpenL();
    94     iOwnerDp = KInvalidDpId;
    95     iOwnerDp = KInvalidDpId;
    95     __FLOG( _L8("-ConstructL") );
    96     OstTraceFunctionExit0( CMTPDELETEOBJECT_CONSTRUCTL_EXIT );
    96     }
    97     }
    97     
    98     
    98 TMTPResponseCode CMTPDeleteObject::CheckRequestL()
    99 TMTPResponseCode CMTPDeleteObject::CheckRequestL()
    99 	{
   100 	{
   100     __FLOG(_L8("CheckRequestL - Entry"));
   101     OstTraceFunctionEntry0( CMTPDELETEOBJECT_CHECKREQUESTL_ENTRY );
   101     TMTPResponseCode responseCode = CMTPRequestProcessor::CheckRequestL();   
   102     TMTPResponseCode responseCode = CMTPRequestProcessor::CheckRequestL();   
   102     
   103 
   103 	__FLOG_VA((_L8("CheckRequestL - Exit with responseCode = 0x%04X"), responseCode));
   104     OstTrace1( TRACE_NORMAL, CMTPDELETEOBJECT_CHECKREQUESTL, "responseCode = 0x%04X", responseCode );
       
   105     OstTraceFunctionExit0( CMTPDELETEOBJECT_CHECKREQUESTL_EXIT );
   104     return responseCode;
   106     return responseCode;
   105 	}
   107 	}
   106 
   108 
   107 /**
   109 /**
   108 DeleteObject request handler
   110 DeleteObject request handler
   109 */ 
   111 */ 
   110 void CMTPDeleteObject::ServiceL()
   112 void CMTPDeleteObject::ServiceL()
   111     {
   113     {
   112     __FLOG( _L8("+ServiceL") );
   114     OstTraceFunctionEntry0( CMTPDELETEOBJECT_SERVICEL_ENTRY );
   113     iTargetDps.Reset();
   115     iTargetDps.Reset();
   114     CMTPParserRouter& router(iSingletons.Router());
   116     CMTPParserRouter& router(iSingletons.Router());
   115     CMTPParserRouter::TRoutingParameters params(Request(), iConnection);
   117     CMTPParserRouter::TRoutingParameters params(Request(), iConnection);
   116     router.ParseOperationRequestL(params);
   118     router.ParseOperationRequestL(params);
   117     router.RouteOperationRequestL(params, iTargetDps);
   119     router.RouteOperationRequestL(params, iTargetDps);
   130 			}
   132 			}
   131 		
   133 		
   132 		if(hasBaseFileSystemDp)
   134 		if(hasBaseFileSystemDp)
   133 			{
   135 			{
   134 			SendResponseL(EMTPRespCodeDeviceBusy);
   136 			SendResponseL(EMTPRespCodeDeviceBusy);
   135 			__FLOG( _L8("-ServiceL with Device_Busy") );
   137 			OstTraceFunctionExit0( CMTPDELETEOBJECT_SERVICEL_EXIT );
   136 			return;
   138 			return;
   137 			}
   139 			}
   138         }
   140         }
   139     
   141     
   140     BrowseHandlesL();
   142     BrowseHandlesL();
   141     
   143 
   142     __FLOG( _L8("-ServiceL") );
   144     OstTraceFunctionExit0( DUP1_CMTPDELETEOBJECT_SERVICEL_EXIT );
   143     }
   145     }
   144 
   146 
   145 void CMTPDeleteObject::ProxyReceiveDataL(MMTPType& /*aData*/, const TMTPTypeRequest& /*aRequest*/, MMTPConnection& /*aConnection*/, TRequestStatus& /*aStatus*/)
   147 void CMTPDeleteObject::ProxyReceiveDataL(MMTPType& /*aData*/, const TMTPTypeRequest& /*aRequest*/, MMTPConnection& /*aConnection*/, TRequestStatus& /*aStatus*/)
   146     {
   148     {
   147     Panic(EMTPWrongRequestPhase);    
   149     Panic(EMTPWrongRequestPhase);    
   191     Schedule(err);
   193     Schedule(err);
   192     }
   194     }
   193 
   195 
   194 void CMTPDeleteObject::RunL()
   196 void CMTPDeleteObject::RunL()
   195     {
   197     {
   196     __FLOG( _L8("+RunL") );
   198     OstTraceFunctionEntry0( CMTPDELETEOBJECT_RUNL_ENTRY );
   197     
   199     
   198     if ( iStatus == KErrNone )
   200     if ( iStatus == KErrNone )
   199         {
   201         {
   200         //First check if the operation has been cancelled or not
   202         //First check if the operation has been cancelled or not
   201         if(iCancelled)
   203         if(iCancelled)
   202             {
   204             {
   203             __FLOG(_L8("Initiator cancell delete, send response with cancelled code "));
   205             OstTrace0( TRACE_NORMAL, CMTPDELETEOBJECT_RUNL, "Initiator cancell delete, send response with cancelled code " );
   204             SendResponseL(EMTPRespCodeTransactionCancelled);
   206             SendResponseL(EMTPRespCodeTransactionCancelled);
   205             iCancelled = EFalse;
   207             iCancelled = EFalse;
   206             }
   208             }
   207         else
   209         else
   208             {
   210             {
   216         }
   218         }
   217     else
   219     else
   218         {
   220         {
   219         SendResponseL( iResponse.Uint16( TMTPTypeResponse::EResponseCode ) );
   221         SendResponseL( iResponse.Uint16( TMTPTypeResponse::EResponseCode ) );
   220         }
   222         }
   221    
   223 
   222     __FLOG( _L8("-RunL") );
   224     OstTraceFunctionExit0( CMTPDELETEOBJECT_RUNL_EXIT );
   223     }
   225     }
   224     
   226     
   225 /**
   227 /**
   226 Completes the current asynchronous request with the specified 
   228 Completes the current asynchronous request with the specified 
   227 completion code.
   229 completion code.
   247     iFramework.SendResponseL(iResponse, req, Connection());
   249     iFramework.SendResponseL(iResponse, req, Connection());
   248     }
   250     }
   249 
   251 
   250 void CMTPDeleteObject::BrowseHandlesL()
   252 void CMTPDeleteObject::BrowseHandlesL()
   251     {
   253     {
   252     __FLOG( _L8("+BrowseHandlesL") );
   254     OstTraceFunctionEntry0( CMTPDELETEOBJECT_BROWSEHANDLESL_ENTRY );
   253     
   255     
   254     delete iObjBrowser;
   256     delete iObjBrowser;
   255     iObjBrowser = NULL;
   257     iObjBrowser = NULL;
   256     iObjBrowser = CMTPObjectBrowser::NewL( iFramework );
   258     iObjBrowser = CMTPObjectBrowser::NewL( iFramework );
   257     
   259     
   277     else
   279     else
   278         {
   280         {
   279         Schedule( KErrNone );
   281         Schedule( KErrNone );
   280         }
   282         }
   281 
   283 
   282     __FLOG( _L8("-BrowseHandlesL") );
   284     OstTraceFunctionExit0( CMTPDELETEOBJECT_BROWSEHANDLESL_EXIT );
   283     }
   285     }
   284 
   286 
   285 void CMTPDeleteObject::NextObjectHandleL()
   287 void CMTPDeleteObject::NextObjectHandleL()
   286     {
   288     {
   287     __FLOG( _L8("+NextObjectHandleL") );
   289     OstTraceFunctionEntry0( CMTPDELETEOBJECT_NEXTOBJECTHANDLEL_ENTRY );
   288 
   290 
   289     iOwnerDp = KInvalidDpId;
   291     iOwnerDp = KInvalidDpId;
   290     if ( iCurrentHandle < iHandles.Count() )
   292     if ( iCurrentHandle < iHandles.Count() )
   291         {
   293         {
   292         TUint32 handle = iHandles[iCurrentHandle];
   294         TUint32 handle = iHandles[iCurrentHandle];
   314             {
   316             {
   315             SendResponseL(EMTPRespCodePartialDeletion);
   317             SendResponseL(EMTPRespCodePartialDeletion);
   316             }
   318             }
   317         }
   319         }
   318 
   320 
   319     __FLOG( _L8("-NextObjectHandleL") );
   321     OstTraceFunctionExit0( CMTPDELETEOBJECT_NEXTOBJECTHANDLEL_EXIT );
   320     }
   322     }
   321 
   323 
   322 void CMTPDeleteObject::OnBrowseObjectL( TAny* aSelf, TUint aHandle, TUint32 /*aCurDepth*/ )
   324 void CMTPDeleteObject::OnBrowseObjectL( TAny* aSelf, TUint aHandle, TUint32 /*aCurDepth*/ )
   323     {
   325     {
   324     CMTPDeleteObject* self = reinterpret_cast< CMTPDeleteObject* >( aSelf );
   326     CMTPDeleteObject* self = reinterpret_cast< CMTPDeleteObject* >( aSelf );