mtpfws/mtpfw/dataproviders/proxydp/src/cmtpdeleteobjectproplist.cpp
changeset 47 63cf70d3ecd8
parent 38 48c22c726cf9
child 52 866b4af7ffbe
equal deleted inserted replaced
44:a5deb6b96675 47:63cf70d3ecd8
    22 #include "cmtpdeleteobjectproplist.h"
    22 #include "cmtpdeleteobjectproplist.h"
    23 #include "mtpproxydppanic.h"
    23 #include "mtpproxydppanic.h"
    24 #include "cmtpdataprovidercontroller.h"
    24 #include "cmtpdataprovidercontroller.h"
    25 #include "cmtpobjectmgr.h"
    25 #include "cmtpobjectmgr.h"
    26 #include "cmtpdataprovider.h"
    26 #include "cmtpdataprovider.h"
       
    27 #include "OstTraceDefinitions.h"
       
    28 #ifdef OST_TRACE_COMPILER_IN_USE
       
    29 #include "cmtpdeleteobjectproplistTraces.h"
       
    30 #endif
       
    31 
    27 
    32 
    28 
    33 
    29 // Class constants.
    34 // Class constants.
    30 __FLOG_STMT(_LIT8(KComponent,"DeleteObjectPropList");)
       
    31 
    35 
    32 
    36 
    33 /**
    37 /**
    34 Verification data for the DeleteObjectPropList request
    38 Verification data for the DeleteObjectPropList request
    35 */
    39 */
    56 /**
    60 /**
    57 Destructor
    61 Destructor
    58 */ 
    62 */ 
    59 CMTPDeleteObjectPropList::~CMTPDeleteObjectPropList()
    63 CMTPDeleteObjectPropList::~CMTPDeleteObjectPropList()
    60     {
    64     {
    61     __FLOG(_L8("~CMTPDeleteObjectPropList - Entry"));
    65     OstTraceFunctionEntry0( CMTPDELETEOBJECTPROPLIST_CMTPDELETEOBJECTPROPLIST_DES_ENTRY );
    62     
    66     
    63     delete iDeleteObjectPropList;
    67     delete iDeleteObjectPropList;
    64     iSingletons.Close();
    68     iSingletons.Close();
    65     iTargetDps.Close();
    69     iTargetDps.Close();
    66     iSubDatasets.ResetAndDestroy();
    70     iSubDatasets.ResetAndDestroy();
    67     
    71 
    68     __FLOG(_L8("~CMTPDeleteObjectPropList - Exit"));
    72     OstTraceFunctionExit0( CMTPDELETEOBJECTPROPLIST_CMTPDELETEOBJECTPROPLIST_DES_EXIT );
    69     __FLOG_CLOSE;
       
    70     }
    73     }
    71 
    74 
    72 CMTPDeleteObjectPropList::CMTPDeleteObjectPropList(MMTPDataProviderFramework& aFramework, MMTPConnection& aConnection):
    75 CMTPDeleteObjectPropList::CMTPDeleteObjectPropList(MMTPDataProviderFramework& aFramework, MMTPConnection& aConnection):
    73 CMTPRequestProcessor( aFramework, aConnection, (sizeof(KMTPDeleteObjectPropListPolicy) / sizeof(TMTPRequestElementInfo)), KMTPDeleteObjectPropListPolicy )
    76 CMTPRequestProcessor( aFramework, aConnection, (sizeof(KMTPDeleteObjectPropListPolicy) / sizeof(TMTPRequestElementInfo)), KMTPDeleteObjectPropListPolicy )
    74     {
    77     {
    75     
    78     
    76     }
    79     }
    77 
    80 
    78 void CMTPDeleteObjectPropList::ConstructL()
    81 void CMTPDeleteObjectPropList::ConstructL()
    79     {
    82     {
    80     __FLOG_OPEN(KMTPSubsystem, KComponent);
    83     OstTraceFunctionEntry0( CMTPDELETEOBJECTPROPLIST_CONSTRUCTL_ENTRY );
    81     __FLOG(_L8("ConstructL - Entry"));
       
    82     
    84     
    83     iSingletons.OpenL();
    85     iSingletons.OpenL();
    84     
    86     
    85     __FLOG(_L8("ConstructL - Exit"));
    87     OstTraceFunctionExit0( CMTPDELETEOBJECTPROPLIST_CONSTRUCTL_EXIT );
    86     }
    88     }
    87 
    89 
    88 void CMTPDeleteObjectPropList::ServiceL()
    90 void CMTPDeleteObjectPropList::ServiceL()
    89     {
    91     {
    90     __FLOG(_L8("ServiceL - Entry"));
    92     OstTraceFunctionEntry0( CMTPDELETEOBJECTPROPLIST_SERVICEL_ENTRY );
    91     
    93     
    92     delete iDeleteObjectPropList;
    94     delete iDeleteObjectPropList;
    93     iTargetDps.Reset();
    95     iTargetDps.Reset();
    94     iSubDatasets.Reset();
    96     iSubDatasets.Reset();
    95     
    97     
    96 
    98 
    97     iDeleteObjectPropList = CMTPTypeDeleteObjectPropList::NewL();
    99     iDeleteObjectPropList = CMTPTypeDeleteObjectPropList::NewL();
    98     ReceiveDataL(*iDeleteObjectPropList);
   100     ReceiveDataL(*iDeleteObjectPropList);
    99 
   101 
   100     __FLOG(_L8("ServiceL - Exit"));
   102     OstTraceFunctionExit0( CMTPDELETEOBJECTPROPLIST_SERVICEL_EXIT );
   101     }
   103     }
   102 
   104 
   103 TBool CMTPDeleteObjectPropList::DoHandleResponsePhaseL()
   105 TBool CMTPDeleteObjectPropList::DoHandleResponsePhaseL()
   104     {
   106     {
   105     __FLOG(_L8("DoHandleResponsePhaseL - Entry"));
   107     OstTraceFunctionEntry0( CMTPDELETEOBJECTPROPLIST_DOHANDLERESPONSEPHASEL_ENTRY );
   106       
   108       
   107     //if the ObjectHandle is 0x00000000, 
   109     //if the ObjectHandle is 0x00000000, 
   108     //discard the received data and return Invalid_ObjectHandle error code
   110     //discard the received data and return Invalid_ObjectHandle error code
   109     if ( Request().Uint32(TMTPTypeRequest::ERequestParameter1) == KMTPHandleNone )
   111     if ( Request().Uint32(TMTPTypeRequest::ERequestParameter1) == KMTPHandleNone )
   110      {  
   112      {  
   123 	     iCurrentTarget = 0;
   125 	     iCurrentTarget = 0;
   124 	     
   126 	     
   125 	     Schedule(KErrNone);
   127 	     Schedule(KErrNone);
   126     	 }
   128     	 }
   127      }
   129      }
   128     
   130 
   129     __FLOG(_L8("DoHandleResponsePhaseL - Exit"));
   131     OstTraceFunctionExit0( CMTPDELETEOBJECTPROPLIST_DOHANDLERESPONSEPHASEL_EXIT );
   130     
       
   131     return EFalse;
   132     return EFalse;
   132     }
   133     }
   133 
   134 
   134 void CMTPDeleteObjectPropList::BuildSubRequestsL()
   135 void CMTPDeleteObjectPropList::BuildSubRequestsL()
   135     {
   136     {
   136     __FLOG(_L8("BuildSubRequests - Entry"));
   137     OstTraceFunctionEntry0( CMTPDELETEOBJECTPROPLIST_BUILDSUBREQUESTSL_ENTRY );
   137 
   138 
   138     TInt count(iDeleteObjectPropList->NumberOfElements());
   139     TInt count(iDeleteObjectPropList->NumberOfElements());
   139     TInt dpid(0);
   140     TInt dpid(0);
   140     TInt index(-1);
   141     TInt index(-1);
   141     TInt tmpDpid(-1);
   142     TInt tmpDpid(-1);
   162             iSubDatasets[index]->AppendL( element );
   163             iSubDatasets[index]->AppendL( element );
   163             }
   164             }
   164         
   165         
   165         CleanupStack::Pop(element);
   166         CleanupStack::Pop(element);
   166         }
   167         }
   167     
   168 
   168     __FLOG(_L8("BuildSubRequests - Exit"));
   169     OstTraceFunctionExit0( CMTPDELETEOBJECTPROPLIST_BUILDSUBREQUESTSL_EXIT );
   169     }
   170     }
   170 
   171 
   171 TBool CMTPDeleteObjectPropList::HasDataphase() const
   172 TBool CMTPDeleteObjectPropList::HasDataphase() const
   172     {
   173     {
   173     __FLOG(_L8("HasDataphase - Entry"));
       
   174         
       
   175     
       
   176         
       
   177     __FLOG(_L8("HasDataphase - Exit"));
       
   178     
       
   179     return ETrue;
   174     return ETrue;
   180     }
   175     }
   181 
   176 
   182 
   177 
   183 #ifdef _DEBUG
   178 #ifdef _DEBUG
   194     }
   189     }
   195 
   190 
   196 
   191 
   197 void CMTPDeleteObjectPropList::ProxySendDataL(const MMTPType& /*aData*/, const TMTPTypeRequest&  /*aRequest*/, MMTPConnection& /* aConnection */, TRequestStatus& /*aStatus*/)
   192 void CMTPDeleteObjectPropList::ProxySendDataL(const MMTPType& /*aData*/, const TMTPTypeRequest&  /*aRequest*/, MMTPConnection& /* aConnection */, TRequestStatus& /*aStatus*/)
   198     {
   193     {
   199     __FLOG(_L8("ProxySendDataL - Entry"));
   194     OstTraceFunctionEntry0( CMTPDELETEOBJECTPROPLIST_PROXYSENDDATAL_ENTRY );
   200         
   195         
   201     Panic(EMTPWrongRequestPhase);
   196     Panic(EMTPWrongRequestPhase);
   202         
   197 
   203     __FLOG(_L8("ProxySendDataL - Exit"));
   198     OstTraceFunctionExit0( CMTPDELETEOBJECTPROPLIST_PROXYSENDDATAL_EXIT );
   204     }
   199     }
   205 
   200 
   206 /**
   201 /**
   207   Send the corresponding response for the request is routed by Proxy DP
   202   Send the corresponding response for the request is routed by Proxy DP
   208   ProxySendResponseL will complete the request of framework's AO, then switch the transaction phase to TranscationComplete
   203   ProxySendResponseL will complete the request of framework's AO, then switch the transaction phase to TranscationComplete
   216 void CMTPDeleteObjectPropList::ProxySendResponseL(const TMTPTypeResponse& aResponse, const TMTPTypeRequest& aRequest, MMTPConnection& aConnection, TRequestStatus& aStatus)
   211 void CMTPDeleteObjectPropList::ProxySendResponseL(const TMTPTypeResponse& aResponse, const TMTPTypeRequest& aRequest, MMTPConnection& aConnection, TRequestStatus& aStatus)
   217 #else
   212 #else
   218 void CMTPDeleteObjectPropList::ProxySendResponseL(const TMTPTypeResponse& aResponse, const TMTPTypeRequest& /*aRequest*/, MMTPConnection& /*aConnection*/, TRequestStatus& aStatus)
   213 void CMTPDeleteObjectPropList::ProxySendResponseL(const TMTPTypeResponse& aResponse, const TMTPTypeRequest& /*aRequest*/, MMTPConnection& /*aConnection*/, TRequestStatus& aStatus)
   219 #endif
   214 #endif
   220     {
   215     {
   221     __FLOG(_L8("ProxySendResponseL - Entry"));
   216     OstTraceFunctionEntry0( CMTPDELETEOBJECTPROPLIST_PROXYSENDRESPONSEL_ENTRY );
   222     
   217     
   223     __ASSERT_DEBUG(((iRequest == &aRequest) && (&iConnection == &aConnection)), Panic(EMTPNotSameRequestProxy));
   218     __ASSERT_DEBUG(((iRequest == &aRequest) && (&iConnection == &aConnection)), Panic(EMTPNotSameRequestProxy));
   224     MMTPType::CopyL(aResponse, iResponse);
   219     MMTPType::CopyL(aResponse, iResponse);
   225     TRequestStatus* status = &aStatus;
   220     TRequestStatus* status = &aStatus;
   226     User::RequestComplete(status, KErrNone);
   221     User::RequestComplete(status, KErrNone);
   227     
   222 
   228     __FLOG(_L8("ProxySendResponseL - Exit"));
   223     OstTraceFunctionExit0( CMTPDELETEOBJECTPROPLIST_PROXYSENDRESPONSEL_EXIT );
   229     }
   224     }
   230 
   225 
   231 
   226 
   232 /**
   227 /**
   233   Complete the transaction phase for the request is routed by Proxy DP
   228   Complete the transaction phase for the request is routed by Proxy DP
   239 void CMTPDeleteObjectPropList::ProxyTransactionCompleteL(const TMTPTypeRequest& aRequest, MMTPConnection& aConnection)
   234 void CMTPDeleteObjectPropList::ProxyTransactionCompleteL(const TMTPTypeRequest& aRequest, MMTPConnection& aConnection)
   240 #else
   235 #else
   241 void CMTPDeleteObjectPropList::ProxyTransactionCompleteL(const TMTPTypeRequest& /*aRequest*/, MMTPConnection& /*aConnection*/)
   236 void CMTPDeleteObjectPropList::ProxyTransactionCompleteL(const TMTPTypeRequest& /*aRequest*/, MMTPConnection& /*aConnection*/)
   242 #endif
   237 #endif
   243     {
   238     {
   244     __FLOG(_L8("ProxyTransactionCompleteL - Entry"));
   239     OstTraceFunctionEntry0( CMTPDELETEOBJECTPROPLIST_PROXYTRANSACTIONCOMPLETEL_ENTRY );
   245         
   240         
   246     __ASSERT_DEBUG(((iRequest == &aRequest) && (&iConnection == &aConnection)), Panic(EMTPNotSameRequestProxy));
   241     __ASSERT_DEBUG(((iRequest == &aRequest) && (&iConnection == &aConnection)), Panic(EMTPNotSameRequestProxy));
   247     const TUint16 KResponseCode(iResponse.Uint16(TMTPTypeResponse::EResponseCode)); 
   242     const TUint16 KResponseCode(iResponse.Uint16(TMTPTypeResponse::EResponseCode)); 
   248     TInt err((KResponseCode == EMTPRespCodeOK) ? KErrNone : KErrGeneral);    
   243     TInt err((KResponseCode == EMTPRespCodeOK) ? KErrNone : KErrGeneral);    
   249     if (err == KErrNone)
   244     if (err == KErrNone)
   265             iResponse.SetUint16(TMTPTypeResponse::EResponseCode, EMTPRespCodeInvalidObjectHandle );
   260             iResponse.SetUint16(TMTPTypeResponse::EResponseCode, EMTPRespCodeInvalidObjectHandle );
   266             }
   261             }
   267         }
   262         }
   268 
   263 
   269     Schedule(err);
   264     Schedule(err);
   270         
   265 
   271     __FLOG(_L8("ProxyTransactionCompleteL - Exit"));
   266     OstTraceFunctionExit0( CMTPDELETEOBJECTPROPLIST_PROXYTRANSACTIONCOMPLETEL_EXIT );
   272     }
   267     }
   273 
   268 
   274 
   269 
   275     
   270     
   276 void CMTPDeleteObjectPropList::SendResponseL(TUint16 aCode)
   271 void CMTPDeleteObjectPropList::SendResponseL(TUint16 aCode)
   277     {
   272     {
   278     __FLOG(_L8("SendResponseL - Entry"));
   273     OstTraceFunctionEntry0( CMTPDELETEOBJECTPROPLIST_SENDRESPONSEL_ENTRY );
   279         
   274         
   280     const TMTPTypeRequest& req(Request());
   275     const TMTPTypeRequest& req(Request());
   281     iResponse.SetUint16(TMTPTypeResponse::EResponseCode, aCode);
   276     iResponse.SetUint16(TMTPTypeResponse::EResponseCode, aCode);
   282     iResponse.SetUint32(TMTPTypeResponse::EResponseSessionID, req.Uint32(TMTPTypeRequest::ERequestSessionID));
   277     iResponse.SetUint32(TMTPTypeResponse::EResponseSessionID, req.Uint32(TMTPTypeRequest::ERequestSessionID));
   283     iResponse.SetUint32(TMTPTypeResponse::EResponseTransactionID, req.Uint32(TMTPTypeRequest::ERequestTransactionID));
   278     iResponse.SetUint32(TMTPTypeResponse::EResponseTransactionID, req.Uint32(TMTPTypeRequest::ERequestTransactionID));
   284     iFramework.SendResponseL(iResponse, req, Connection());
   279     iFramework.SendResponseL(iResponse, req, Connection());
   285         
   280 
   286     __FLOG(_L8("SendResponseL - Exit"));
   281     OstTraceFunctionExit0( CMTPDELETEOBJECTPROPLIST_SENDRESPONSEL_EXIT );
   287     }
   282     }
   288 
   283 
   289 void CMTPDeleteObjectPropList::RunL()
   284 void CMTPDeleteObjectPropList::RunL()
   290     {
   285     {
   291     __FLOG(_L8("RunL - Entry"));
   286     OstTraceFunctionEntry0( CMTPDELETEOBJECTPROPLIST_RUNL_ENTRY );
   292     
   287     
   293     if ( (iStatus == KErrNone) && (iCurrentTarget < iTargetDps.Count()) )    
   288     if ( (iStatus == KErrNone) && (iCurrentTarget < iTargetDps.Count()) )    
   294         {
   289         {
   295         TUint id(iTargetDps[iCurrentTarget]);
   290         TUint id(iTargetDps[iCurrentTarget]);
   296         
   291         
   312     else        
   307     else        
   313         {
   308         {
   314         //Any error will stop the process, and send the corresponding response.
   309         //Any error will stop the process, and send the corresponding response.
   315         SendResponseL(iResponse.Uint16(TMTPTypeResponse::EResponseCode));
   310         SendResponseL(iResponse.Uint16(TMTPTypeResponse::EResponseCode));
   316         }  
   311         }  
   317     
   312 
   318     __FLOG(_L8("RunL - Exit"));
   313     OstTraceFunctionExit0( CMTPDELETEOBJECTPROPLIST_RUNL_EXIT );
   319     }
   314     }
   320         
   315         
   321 TInt CMTPDeleteObjectPropList::RunError(TInt /*aError*/)
   316 TInt CMTPDeleteObjectPropList::RunError(TInt /*aError*/)
   322     {
   317     {
   323     __FLOG(_L8("RunError - Entry"));
   318     OstTraceFunctionEntry0( CMTPDELETEOBJECTPROPLIST_RUNERROR_ENTRY );
   324     
   319 
   325     TRAP_IGNORE(SendResponseL(EMTPRespCodeGeneralError));
   320     TRAP_IGNORE(SendResponseL(EMTPRespCodeGeneralError));
   326     
   321 
   327     __FLOG(_L8("RunError - Exit"));
   322     OstTraceFunctionExit0( CMTPDELETEOBJECTPROPLIST_RUNERROR_EXIT );
   328     return KErrNone;
   323     return KErrNone;
   329     }
   324     }
   330             
   325             
   331 /**
   326 /**
   332 Completes the current asynchronous request with the specified 
   327 Completes the current asynchronous request with the specified 
   333 completion code.
   328 completion code.
   334 @param aError The asynchronous request completion request.
   329 @param aError The asynchronous request completion request.
   335 */
   330 */
   336 void CMTPDeleteObjectPropList::Schedule(TInt aError)
   331 void CMTPDeleteObjectPropList::Schedule(TInt aError)
   337     {
   332     {
   338     __FLOG(_L8("Schedule - Entry"));
   333     OstTraceFunctionEntry0( CMTPDELETEOBJECTPROPLIST_SCHEDULE_ENTRY );
   339     
   334 
   340     TRequestStatus* status = &iStatus;
   335     TRequestStatus* status = &iStatus;
   341     User::RequestComplete(status, aError);
   336     User::RequestComplete(status, aError);
   342     SetActive();
   337     SetActive();
   343     
   338 
   344     __FLOG(_L8("Schedule - Exit"));
   339     OstTraceFunctionExit0( CMTPDELETEOBJECTPROPLIST_SCHEDULE_EXIT );
   345     }
   340     }
   346 
   341 
   347 
   342