mtpdataproviders/mtppictbridgedp/src/cmtppictbridgedpsendobjectinfo.cpp
changeset 47 63cf70d3ecd8
parent 38 48c22c726cf9
equal deleted inserted replaced
44:a5deb6b96675 47:63cf70d3ecd8
    33 #include "mtppictbridgedpconst.h"
    33 #include "mtppictbridgedpconst.h"
    34 #include "cmtppictbridgeprinter.h"
    34 #include "cmtppictbridgeprinter.h"
    35 #include "cptpserver.h"
    35 #include "cptpserver.h"
    36 #include "cmtpconnection.h"
    36 #include "cmtpconnection.h"
    37 #include "cmtpconnectionmgr.h"
    37 #include "cmtpconnectionmgr.h"
       
    38 #include "mtpdebug.h"
       
    39 #include "OstTraceDefinitions.h"
       
    40 #ifdef OST_TRACE_COMPILER_IN_USE
       
    41 #include "cmtppictbridgedpsendobjectinfoTraces.h"
       
    42 #endif
       
    43 
    38 
    44 
    39 /**
    45 /**
    40 Verification data for the SendObjectInfo request
    46 Verification data for the SendObjectInfo request
    41 */
    47 */
    42 const TMTPRequestElementInfo KMTPSendObjectInfoPolicy[] = 
    48 const TMTPRequestElementInfo KMTPSendObjectInfoPolicy[] = 
    67 /**
    73 /**
    68 Destructor
    74 Destructor
    69 */    
    75 */    
    70 CMTPPictBridgeDpSendObjectInfo::~CMTPPictBridgeDpSendObjectInfo()
    76 CMTPPictBridgeDpSendObjectInfo::~CMTPPictBridgeDpSendObjectInfo()
    71     {
    77     {
    72     __FLOG_VA((_L8(">> CMTPPictBridgeDpSendObjectInfo::~CMTPPictBridgeDpSendObjectInfo iProgress=%d iNoRollback=%d "), iProgress, iNoRollback));
    78     OstTraceFunctionEntry0( CMTPPICTBRIDGEDPSENDOBJECTINFO_CMTPPICTBRIDGEDPSENDOBJECTINFO_DES_ENTRY );
    73     __FLOG_2(_L8("iProgress:%d NoRollback:%d"),iProgress,iNoRollback);
    79     OstTraceExt2( TRACE_NORMAL, CMTPPICTBRIDGEDPSENDOBJECTINFO_CMTPPICTBRIDGEDPSENDOBJECTINFO, 
       
    80             "iProgress=%d iNoRollback=%d ", iProgress, iNoRollback );
    74     
    81     
    75     if ((iProgress == EObjectInfoSucceed || 
    82     if ((iProgress == EObjectInfoSucceed || 
    76         iProgress == EObjectInfoFail || 
    83         iProgress == EObjectInfoFail || 
    77         iProgress == EObjectInfoInProgress) && !iNoRollback)
    84         iProgress == EObjectInfoInProgress) && !iNoRollback)
    78         {
    85         {
    86     delete iParentSuidP;    
    93     delete iParentSuidP;    
    87     delete iReceivedObjectP;
    94     delete iReceivedObjectP;
    88     delete iObjectInfoP;
    95     delete iObjectInfoP;
    89     delete iObjectPropList;
    96     delete iObjectPropList;
    90 
    97 
    91     __FLOG(_L8("<< CMTPPictBridgeDpSendObjectInfo::~CMTPPictBridgeDpSendObjectInfo"));
    98     OstTraceFunctionExit0( CMTPPICTBRIDGEDPSENDOBJECTINFO_CMTPPICTBRIDGEDPSENDOBJECTINFO_DES_EXIT );
    92     __FLOG_CLOSE;
       
    93     }
    99     }
    94 
   100 
    95 /**
   101 /**
    96 Standard c++ constructor
   102 Standard c++ constructor
    97 @param aFramework    The data provider framework
   103 @param aFramework    The data provider framework
   107 Verify the request
   113 Verify the request
   108 @return EMTPRespCodeOK if request is verified, otherwise one of the error response codes
   114 @return EMTPRespCodeOK if request is verified, otherwise one of the error response codes
   109 */    
   115 */    
   110 TMTPResponseCode CMTPPictBridgeDpSendObjectInfo::CheckRequestL()
   116 TMTPResponseCode CMTPPictBridgeDpSendObjectInfo::CheckRequestL()
   111     {
   117     {
   112     __FLOG(_L8(">> CMTPPictBridgeDpSendObjectInfo::CheckRequestL"));    
   118     OstTraceFunctionEntry0( CMTPPICTBRIDGEDPSENDOBJECTINFO_CHECKREQUESTL_ENTRY );   
   113     TMTPResponseCode result = CheckSendingStateL();
   119     TMTPResponseCode result = CheckSendingStateL();
   114     
   120     
   115     if (result != EMTPRespCodeOK) 
   121     if (result != EMTPRespCodeOK) 
   116         {
   122         {
       
   123         OstTraceFunctionExit0( CMTPPICTBRIDGEDPSENDOBJECTINFO_CHECKREQUESTL_EXIT );
   117         return result;
   124         return result;
   118         }
   125         }
   119     
   126     
   120     if (iProgress == EObjectNone)    //this is the SendObjectInfo phase
   127     if (iProgress == EObjectNone)    //this is the SendObjectInfo phase
   121         {
   128         {
   155         if (iPreviousTransactionID + 1 != Request().Uint32(TMTPTypeRequest::ERequestTransactionID))
   162         if (iPreviousTransactionID + 1 != Request().Uint32(TMTPTypeRequest::ERequestTransactionID))
   156             {
   163             {
   157             result = EMTPRespCodeNoValidObjectInfo;
   164             result = EMTPRespCodeNoValidObjectInfo;
   158             }
   165             }
   159         }
   166         }
   160         
   167 
   161     __FLOG_VA((_L8("<< CMTPPictBridgeDpSendObjectInfo::CheckRequestL 0x%04x"), result));    
   168     OstTrace1( TRACE_NORMAL, CMTPPICTBRIDGEDPSENDOBJECTINFO_CHECKREQUESTL, "result 0x%04x", result );
   162 
   169     OstTraceFunctionExit0( DUP1_CMTPPICTBRIDGEDPSENDOBJECTINFO_CHECKREQUESTL_EXIT );
   163     return result;    
   170     return result;    
   164     }
   171     }
   165     
   172     
   166 TBool CMTPPictBridgeDpSendObjectInfo::HasDataphase() const
   173 TBool CMTPPictBridgeDpSendObjectInfo::HasDataphase() const
   167     {
   174     {
   173 NOTE: SendObjectInfo has to be comes before SendObject requests.  To maintain the state information
   180 NOTE: SendObjectInfo has to be comes before SendObject requests.  To maintain the state information
   174 between the two requests, the two requests are combined together in one request processor.
   181 between the two requests, the two requests are combined together in one request processor.
   175 */    
   182 */    
   176 void CMTPPictBridgeDpSendObjectInfo::ServiceL()
   183 void CMTPPictBridgeDpSendObjectInfo::ServiceL()
   177     {
   184     {
   178     __FLOG(_L8(">> CMTPPictBridgeDpSendObjectInfo::ServiceL"));
   185     OstTraceFunctionEntry0( CMTPPICTBRIDGEDPSENDOBJECTINFO_SERVICEL_ENTRY );
   179     if (iProgress == EObjectNone)
   186     if (iProgress == EObjectNone)
   180         {
   187         {
   181         if ( EMTPOpCodeSendObjectInfo == iOperationCode )
   188         if ( EMTPOpCodeSendObjectInfo == iOperationCode )
   182             {
   189             {
   183             ServiceSendObjectInfoL();
   190             ServiceSendObjectInfoL();
   188             }
   195             }
   189         }
   196         }
   190     else
   197     else
   191         {
   198         {
   192         ServiceSendObjectL();
   199         ServiceSendObjectL();
   193         }    
   200         }      
   194     __FLOG(_L8("<< CMTPPictBridgeDpSendObjectInfo::ServiceL"));    
   201     OstTraceFunctionExit0( CMTPPICTBRIDGEDPSENDOBJECTINFO_SERVICEL_EXIT );
   195     }
   202     }
   196 
   203 
   197 /**
   204 /**
   198 Second-phase construction
   205 Second-phase construction
   199 */        
   206 */        
   200 void CMTPPictBridgeDpSendObjectInfo::ConstructL()
   207 void CMTPPictBridgeDpSendObjectInfo::ConstructL()
   201     {
   208     {
   202     __FLOG_OPEN(KMTPSubsystem, KComponent);
   209     OstTraceFunctionEntry0( CMTPPICTBRIDGEDPSENDOBJECTINFO_CONSTRUCTL_ENTRY );   
   203     __FLOG(_L8(">> CMTPPictBridgeDpSendObjectInfo::ConstructL"));      
       
   204     iExpectedSendObjectRequest.SetUint16(TMTPTypeRequest::ERequestOperationCode, EMTPOpCodeSendObject);
   210     iExpectedSendObjectRequest.SetUint16(TMTPTypeRequest::ERequestOperationCode, EMTPOpCodeSendObject);
   205     iReceivedObjectP = CMTPObjectMetaData::NewL();
   211     iReceivedObjectP = CMTPObjectMetaData::NewL();
   206     iReceivedObjectP->SetUint(CMTPObjectMetaData::EDataProviderId, iFramework.DataProviderId());
   212     iReceivedObjectP->SetUint(CMTPObjectMetaData::EDataProviderId, iFramework.DataProviderId());
   207     iDpSingletons.OpenL(iFramework);
   213     iDpSingletons.OpenL(iFramework);
   208     iNoRollback = EFalse;
   214     iNoRollback = EFalse;
   209     __FLOG(_L8("<< CMTPPictBridgeDpSendObjectInfo::ConstructL"));    
   215     OstTraceFunctionExit0( CMTPPICTBRIDGEDPSENDOBJECTINFO_CONSTRUCTL_EXIT );
   210     }
   216     }
   211 
   217 
   212 /**
   218 /**
   213 Override to match both the SendObjectInfo and SendObject requests
   219 Override to match both the SendObjectInfo and SendObject requests
   214 @param aRequest    The request to match
   220 @param aRequest    The request to match
   215 @param aConnection The connection from which the request comes
   221 @param aConnection The connection from which the request comes
   216 @return ETrue if the processor can handle the request, otherwise EFalse
   222 @return ETrue if the processor can handle the request, otherwise EFalse
   217 */        
   223 */        
   218 TBool CMTPPictBridgeDpSendObjectInfo::Match(const TMTPTypeRequest& aRequest, MMTPConnection& aConnection) const
   224 TBool CMTPPictBridgeDpSendObjectInfo::Match(const TMTPTypeRequest& aRequest, MMTPConnection& aConnection) const
   219     {
   225     {
   220     __FLOG(_L8(">> CMTPPictBridgeDpSendObjectInfo::Match"));    
   226     OstTraceFunctionEntry0( CMTPPICTBRIDGEDPSENDOBJECTINFO_MATCH_ENTRY );
   221     TBool result = EFalse;
   227     TBool result = EFalse;
   222     TUint16 operationCode = aRequest.Uint16(TMTPTypeRequest::ERequestOperationCode);
   228     TUint16 operationCode = aRequest.Uint16(TMTPTypeRequest::ERequestOperationCode);
   223     if ((operationCode == EMTPOpCodeSendObjectInfo || 
   229     if ((operationCode == EMTPOpCodeSendObjectInfo || 
   224         operationCode == EMTPOpCodeSendObject ||
   230         operationCode == EMTPOpCodeSendObject ||
   225         operationCode == EMTPOpCodeSendObjectPropList) &&
   231         operationCode == EMTPOpCodeSendObjectPropList) &&
   226         &iConnection == &aConnection)
   232         &iConnection == &aConnection)
   227         {
   233         {
   228         result = ETrue;
   234         result = ETrue;
   229         }
   235         } 
   230     __FLOG(_L8("<< CMTPPictBridgeDpSendObjectInfo::Match"));    
   236     OstTraceFunctionExit0( CMTPPICTBRIDGEDPSENDOBJECTINFO_MATCH_EXIT );
   231     return result;    
   237     return result;    
   232     }
   238     }
   233 
   239 
   234 /**
   240 /**
   235 Override to handle the response phase of SendObjectInfo and SendObject requests
   241 Override to handle the response phase of SendObjectInfo and SendObject requests
   236 @return EFalse
   242 @return EFalse
   237 */
   243 */
   238 TBool CMTPPictBridgeDpSendObjectInfo::DoHandleResponsePhaseL()
   244 TBool CMTPPictBridgeDpSendObjectInfo::DoHandleResponsePhaseL()
   239     {
   245     {
   240     __FLOG_VA((_L8(">> CMTPPictBridgeDpSendObjectInfo::DoHandleResponsePhaseL iProgress==%d opCode==0x%x"),iProgress, iOperationCode));
   246     OstTraceFunctionEntry0( CMTPPICTBRIDGEDPSENDOBJECTINFO_DOHANDLERESPONSEPHASEL_ENTRY );
       
   247     OstTraceExt2( TRACE_NORMAL, CMTPPICTBRIDGEDPSENDOBJECTINFO_DOHANDLERESPONSEPHASEL, 
       
   248             "iProgress==%d opCode==0x%x",iProgress, iOperationCode );
   241     //to check if the sending/receiving data is successful
   249     //to check if the sending/receiving data is successful
   242     TBool successful = !iCancelled;
   250     TBool successful = !iCancelled;
   243     if (iProgress == EObjectInfoInProgress)
   251     if (iProgress == EObjectInfoInProgress)
   244         {
   252         {
   245         if (iOperationCode == EMTPOpCodeSendObjectInfo)
   253         if (iOperationCode == EMTPOpCodeSendObjectInfo)
   254         }
   262         }
   255     else if (iProgress == ESendObjectInProgress)
   263     else if (iProgress == ESendObjectInProgress)
   256         {
   264         {
   257         successful = DoHandleSendObjectCompleteL();
   265         successful = DoHandleSendObjectCompleteL();
   258         iProgress = (successful ? ESendObjectSucceed : ESendObjectFail);
   266         iProgress = (successful ? ESendObjectSucceed : ESendObjectFail);
   259         }        
   267         }          
   260     __FLOG(_L8("<< CMTPPictBridgeDpSendObjectInfo::DoHandleResponsePhaseL"));    
   268     OstTraceFunctionExit0( CMTPPICTBRIDGEDPSENDOBJECTINFO_DOHANDLERESPONSEPHASEL_EXIT );
   261     return EFalse;
   269     return EFalse;
   262     }
   270     }
   263 
   271 
   264 /**
   272 /**
   265 Override to handle the completing phase of SendObjectInfo and SendObject requests
   273 Override to handle the completing phase of SendObjectInfo and SendObject requests
   266 @return ETrue if succesfully received the file, otherwise EFalse
   274 @return ETrue if succesfully received the file, otherwise EFalse
   267 */    
   275 */    
   268 TBool CMTPPictBridgeDpSendObjectInfo::DoHandleCompletingPhaseL()
   276 TBool CMTPPictBridgeDpSendObjectInfo::DoHandleCompletingPhaseL()
   269     {
   277     {
   270     __FLOG_VA((_L8(">> CMTPPictBridgeDpSendObjectInfo::DoHandleCompletingPhaseL iProgress==%d opCode==0x%x"),iProgress, iOperationCode));
   278     OstTraceFunctionEntry0( CMTPPICTBRIDGEDPSENDOBJECTINFO_DOHANDLECOMPLETINGPHASEL_ENTRY );
       
   279     OstTraceExt2( TRACE_NORMAL, CMTPPICTBRIDGEDPSENDOBJECTINFO_DOHANDLECOMPLETINGPHASEL, 
       
   280             " iProgress==%d opCode==0x%x",iProgress, iOperationCode );
       
   281 
   271     TBool result = ETrue;
   282     TBool result = ETrue;
   272     CMTPRequestProcessor::DoHandleCompletingPhaseL();
   283     CMTPRequestProcessor::DoHandleCompletingPhaseL();
   273     if (iProgress == EObjectInfoSucceed)
   284     if (iProgress == EObjectInfoSucceed)
   274         {
   285         {
   275         if (( iOperationCode == EMTPOpCodeSendObjectInfo ) || ( iOperationCode == EMTPOpCodeSendObjectPropList ))
   286         if (( iOperationCode == EMTPOpCodeSendObjectInfo ) || ( iOperationCode == EMTPOpCodeSendObjectPropList ))
   289             iPreviousTransactionID++;
   300             iPreviousTransactionID++;
   290             }
   301             }
   291         iProgress = EObjectInfoSucceed;
   302         iProgress = EObjectInfoSucceed;
   292         result = EFalse;
   303         result = EFalse;
   293         }
   304         }
   294     
   305 
   295     __FLOG_2(_L8("<< CMTPPictBridgeDpSendObjectInfo::DoHandleCompletingPhaseL result:%d progress %d"),result,iProgress);    
   306     OstTraceExt2( TRACE_NORMAL, DUP1_CMTPPICTBRIDGEDPSENDOBJECTINFO_DOHANDLECOMPLETINGPHASEL, 
       
   307             " result:%d progress %d",result,iProgress );    
       
   308     OstTraceFunctionExit0( CMTPPICTBRIDGEDPSENDOBJECTINFO_DOHANDLECOMPLETINGPHASEL_EXIT );
       
   309   
   296     return result;    
   310     return result;    
   297     }
   311     }
   298 
   312 
   299 /**
   313 /**
   300 Verify if the SendObject request comes after SendObjectInfo request
   314 Verify if the SendObject request comes after SendObjectInfo request
   301 @return EMTPRespCodeOK if SendObject request comes after a valid SendObjectInfo request, otherwise
   315 @return EMTPRespCodeOK if SendObject request comes after a valid SendObjectInfo request, otherwise
   302 EMTPRespCodeNoValidObjectInfo
   316 EMTPRespCodeNoValidObjectInfo
   303 */
   317 */
   304 TMTPResponseCode CMTPPictBridgeDpSendObjectInfo::CheckSendingStateL()
   318 TMTPResponseCode CMTPPictBridgeDpSendObjectInfo::CheckSendingStateL()
   305     {
   319     {
   306     __FLOG(_L8(">> CMTPPictBridgeDpSendObjectInfo::CheckSendingStateL"));    
   320     OstTraceFunctionEntry0( CMTPPICTBRIDGEDPSENDOBJECTINFO_CHECKSENDINGSTATEL_ENTRY );   
   307     TMTPResponseCode result = EMTPRespCodeOK;
   321     TMTPResponseCode result = EMTPRespCodeOK;
   308     iOperationCode = Request().Uint16(TMTPTypeRequest::ERequestOperationCode);
   322     iOperationCode = Request().Uint16(TMTPTypeRequest::ERequestOperationCode);
   309 
   323 
   310     if (iOperationCode == EMTPOpCodeSendObject)
   324     if (iOperationCode == EMTPOpCodeSendObject)
   311         {
   325         {
   328         if (iOperationCode == EMTPOpCodeSendObjectInfo || iOperationCode == EMTPOpCodeSendObjectPropList)
   342         if (iOperationCode == EMTPOpCodeSendObjectInfo || iOperationCode == EMTPOpCodeSendObjectPropList)
   329             {
   343             {
   330             // Not finished SendObjectInfo/SendObject pair detected, need to remove the object reservation that was created, unless the object already existed
   344             // Not finished SendObjectInfo/SendObject pair detected, need to remove the object reservation that was created, unless the object already existed
   331             if (!iNoRollback )
   345             if (!iNoRollback )
   332                 {
   346                 {
   333                 __FLOG(_L8("  CMTPPictBridgeDpSendObjectInfo::CheckSendingStateL ... Rolling back!"));
   347                 OstTrace0( TRACE_NORMAL, CMTPPICTBRIDGEDPSENDOBJECTINFO_CHECKSENDINGSTATEL, 
       
   348                         "  CMTPPictBridgeDpSendObjectInfo::CheckSendingStateL ... Rolling back!" );
   334                 Rollback();
   349                 Rollback();
   335                 }
   350                 }
   336 
   351 
   337             delete iObjectInfoP;
   352             delete iObjectInfoP;
   338             iObjectInfoP = NULL;
   353             iObjectInfoP = NULL;
   341             iProgress = EObjectNone;
   356             iProgress = EObjectNone;
   342             }
   357             }
   343         }
   358         }
   344     else 
   359     else 
   345         {
   360         {
       
   361         OstTrace1( TRACE_ERROR, DUP1_CMTPPICTBRIDGEDPSENDOBJECTINFO_CHECKSENDINGSTATEL, 
       
   362                 "Progress %d is invalid here!", iProgress);  
   346         User::Leave( KErrGeneral );
   363         User::Leave( KErrGeneral );
   347         }
   364         }
   348     __FLOG(_L8("<< CMTPPictBridgeDpSendObjectInfo::CheckSendingStateL"));    
   365     OstTraceFunctionExit0( CMTPPICTBRIDGEDPSENDOBJECTINFO_CHECKSENDINGSTATEL_EXIT );
   349     return result;    
   366     return result;    
   350     }
   367     }
   351 
   368 
   352 /**
   369 /**
   353 SendObjectInfo request handler
   370 SendObjectInfo request handler
   385 /**
   402 /**
   386 Get a default parent object, if the request does not specify a parent object.
   403 Get a default parent object, if the request does not specify a parent object.
   387 */
   404 */
   388 void CMTPPictBridgeDpSendObjectInfo::GetDefaultParentObjectL()
   405 void CMTPPictBridgeDpSendObjectInfo::GetDefaultParentObjectL()
   389     {    
   406     {    
   390     __FLOG(_L8(">> CMTPPictBridgeDpSendObjectInfo::GetDefaultParentObjectL"));    
   407     OstTraceFunctionEntry0( CMTPPICTBRIDGEDPSENDOBJECTINFO_GETDEFAULTPARENTOBJECTL_ENTRY );   
   391 
   408 
   392     if (iStorageId == KMTPStorageDefault)
   409     if (iStorageId == KMTPStorageDefault)
   393         {
   410         {
   394         iStorageId = iFramework.StorageMgr().DefaultStorageId();
   411         iStorageId = iFramework.StorageMgr().DefaultStorageId();
   395         }
   412         }
   396     TInt drive(static_cast<TDriveNumber>(iFramework.StorageMgr().DriveNumber(iStorageId)));
   413     TInt drive(static_cast<TDriveNumber>(iFramework.StorageMgr().DriveNumber(iStorageId)));
   397     User::LeaveIfError(drive);
   414     LEAVEIFERROR(drive,
       
   415             OstTrace1( TRACE_ERROR, CMTPPICTBRIDGEDPSENDOBJECTINFO_GETDEFAULTPARENTOBJECTL, 
       
   416                     "Can't identify drive number for storage %d", iStorageId ));
   398 
   417 
   399     // Obtain the root of the drive.  Logical storages can sometimes have a filesystem root
   418     // Obtain the root of the drive.  Logical storages can sometimes have a filesystem root
   400     // other than <drive>:\ .  For example an MP3 DP might have a root of c:\media\music\
   419     // other than <drive>:\ .  For example an MP3 DP might have a root of c:\media\music\
   401 
   420 
   402     delete iParentSuidP;
   421     delete iParentSuidP;
   403     iParentSuidP = NULL;
   422     iParentSuidP = NULL;
   404     iParentSuidP=(iFramework.StorageMgr().StorageL(iStorageId).DesC(CMTPStorageMetaData::EStorageSuid)).AllocL();
   423     iParentSuidP=(iFramework.StorageMgr().StorageL(iStorageId).DesC(CMTPStorageMetaData::EStorageSuid)).AllocL();
   405     iReceivedObjectP->SetUint(CMTPObjectMetaData::EParentHandle, KMTPHandleNoParent);
   424     iReceivedObjectP->SetUint(CMTPObjectMetaData::EParentHandle, KMTPHandleNoParent);        
   406     __FLOG(_L8("<< CMTPPictBridgeDpSendObjectInfo::GetDefaultParentObjectL"));            
   425     OstTraceFunctionExit0( CMTPPICTBRIDGEDPSENDOBJECTINFO_GETDEFAULTPARENTOBJECTL_EXIT );
   407     }
   426     }
   408 
   427 
   409 /**
   428 /**
   410 Get parent object and storage id
   429 Get parent object and storage id
   411 @return EMTPRespCodeOK if successful, otherwise, EMTPRespCodeInvalidParentObject
   430 @return EMTPRespCodeOK if successful, otherwise, EMTPRespCodeInvalidParentObject
   412 */
   431 */
   413 TMTPResponseCode CMTPPictBridgeDpSendObjectInfo::GetParentObjectAndStorageIdL()
   432 TMTPResponseCode CMTPPictBridgeDpSendObjectInfo::GetParentObjectAndStorageIdL()
   414     {
   433     {
   415     __FLOG(_L8(">> CMTPPictBridgeDpSendObjectInfo::GetParentObjectAndStorageIdL"));    
   434     OstTraceFunctionEntry0( CMTPPICTBRIDGEDPSENDOBJECTINFO_GETPARENTOBJECTANDSTORAGEIDL_ENTRY ); 
   416     __ASSERT_DEBUG(iRequestChecker, Panic(EMTPPictBridgeDpRequestCheckNull));
   435     __ASSERT_DEBUG(iRequestChecker, Panic(EMTPPictBridgeDpRequestCheckNull));
   417 
   436 
   418     iStorageId = Request().Uint32(TMTPTypeRequest::ERequestParameter1);
   437     iStorageId = Request().Uint32(TMTPTypeRequest::ERequestParameter1);
   419     iParentHandle = Request().Uint32(TMTPTypeRequest::ERequestParameter2);
   438     iParentHandle = Request().Uint32(TMTPTypeRequest::ERequestParameter2);
   420     //does not take ownership
   439     //does not take ownership
   430         iParentSuidP = NULL;
   449         iParentSuidP = NULL;
   431         iParentSuidP = parentObjectInfo->DesC(CMTPObjectMetaData::ESuid).AllocL();
   450         iParentSuidP = parentObjectInfo->DesC(CMTPObjectMetaData::ESuid).AllocL();
   432         iReceivedObjectP->SetUint(CMTPObjectMetaData::EParentHandle, iParentHandle);
   451         iReceivedObjectP->SetUint(CMTPObjectMetaData::EParentHandle, iParentHandle);
   433         }
   452         }
   434 
   453 
   435     __FLOG_VA((_L16("<< CMTPPictBridgeDpSendObjectInfo::GetParentObjectAndStorageIdL %S"), iParentSuidP));    
   454     OstTraceExt1( TRACE_NORMAL, CMTPPICTBRIDGEDPSENDOBJECTINFO_GETPARENTOBJECTANDSTORAGEIDL, 
       
   455             "iParentSuidP: %S", *iParentSuidP );    
       
   456     OstTraceFunctionExit0( CMTPPICTBRIDGEDPSENDOBJECTINFO_GETPARENTOBJECTANDSTORAGEIDL_EXIT );
   436     return EMTPRespCodeOK;
   457     return EMTPRespCodeOK;
   437     }
   458     }
   438 
   459 
   439 /**
   460 /**
   440 Handling the completing phase of SendObjectInfo request
   461 Handling the completing phase of SendObjectInfo request
   441 @return ETrue if the specified object can be saved on the specified location, otherwise, EFalse
   462 @return ETrue if the specified object can be saved on the specified location, otherwise, EFalse
   442 */    
   463 */    
   443 TBool CMTPPictBridgeDpSendObjectInfo::DoHandleSendObjectInfoCompleteL()
   464 TBool CMTPPictBridgeDpSendObjectInfo::DoHandleSendObjectInfoCompleteL()
   444     {
   465     {
   445     __FLOG(_L8(">> CMTPPictBridgeDpSendObjectInfo::DoHandleSendObjectInfoCompleteL"));    
   466     OstTraceFunctionEntry0( CMTPPICTBRIDGEDPSENDOBJECTINFO_DOHANDLESENDOBJECTINFOCOMPLETEL_ENTRY );   
   446     TBool result(ETrue);
   467     TBool result(ETrue);
   447     TUint16 format(iObjectInfoP->Uint16L(CMTPTypeObjectInfo::EObjectFormat));
   468     TUint16 format(iObjectInfoP->Uint16L(CMTPTypeObjectInfo::EObjectFormat));
   448     
   469     
   449     result = IsFormatValid(TMTPFormatCode(format));
   470     result = IsFormatValid(TMTPFormatCode(format));
   450     
   471     
   503         {    
   524         {    
   504         result &= !Exists(iFullPath);
   525         result &= !Exists(iFullPath);
   505         if (!result)
   526         if (!result)
   506             {        
   527             {        
   507             // Object with the same name already exists.
   528             // Object with the same name already exists.
   508             __FLOG(_L8("   no rollback"));
   529             OstTrace0( TRACE_NORMAL, DUP1_CMTPPICTBRIDGEDPSENDOBJECTINFO_ROLLBACK, "   no rollback" );
   509 			iNoRollback = ETrue;
   530 			iNoRollback = ETrue;
   510             SendResponseL(EMTPRespCodeAccessDenied);
   531             SendResponseL(EMTPRespCodeAccessDenied);
   511             }
   532             }
   512         }
   533         }
   513   */
   534   */
   518         iPictBridgeDP.PtpServer()->Printer()->DpsDiscovery(iFullPath, &iConnection);
   539         iPictBridgeDP.PtpServer()->Printer()->DpsDiscovery(iFullPath, &iConnection);
   519         TRAPD(err, CreateFsObjectL()); 
   540         TRAPD(err, CreateFsObjectL()); 
   520         
   541         
   521         if (err != KErrNone)
   542         if (err != KErrNone)
   522             {
   543             {
   523             __FLOG_1(_L8("Fail to create fs object %d"),err);
   544             OstTrace1( TRACE_WARNING, CMTPPICTBRIDGEDPSENDOBJECTINFO_DOHANDLESENDOBJECTINFOCOMPLETEL, 
       
   545                     "Fail to create fs object %d", err );
   524             SendResponseL(ErrorToMTPError(err));
   546             SendResponseL(ErrorToMTPError(err));
   525             result = EFalse;
   547             result = EFalse;
   526             }
   548             }
   527         else
   549         else
   528             {
   550             {
   529             ReserveObjectL();
   551             ReserveObjectL();
   530             }
   552             }
   531         }
   553         } 
   532     __FLOG(_L8("<< CMTPPictBridgeDpSendObjectInfo::DoHandleSendObjectInfoCompleteL"));    
   554     OstTraceFunctionExit0( CMTPPICTBRIDGEDPSENDOBJECTINFO_DOHANDLESENDOBJECTINFOCOMPLETEL_EXIT );
   533     return result;    
   555     return result;    
   534     }
   556     }
   535 
   557 
   536 
   558 
   537 TBool CMTPPictBridgeDpSendObjectInfo::DoHandleSendObjectPropListCompleteL()
   559 TBool CMTPPictBridgeDpSendObjectInfo::DoHandleSendObjectPropListCompleteL()
   538     {
   560     {
   539     __FLOG(_L8(">> CMTPPictBridgeDpSendObjectInfo::DoHandleSendObjectPropListCompleteL"));
   561     OstTraceFunctionEntry0( CMTPPICTBRIDGEDPSENDOBJECTINFO_DOHANDLESENDOBJECTPROPLISTCOMPLETEL_ENTRY );
   540     TBool result(ETrue);
   562     TBool result(ETrue);
   541     TMTPResponseCode responseCode( GetParentObjectAndStorageIdL() );
   563     TMTPResponseCode responseCode( GetParentObjectAndStorageIdL() );
   542     if ( responseCode != EMTPRespCodeOK )
   564     if ( responseCode != EMTPRespCodeOK )
   543         {
   565         {
   544         SendResponseL( responseCode );
   566         SendResponseL( responseCode );
   566         iReceivedObjectP->SetUint(CMTPObjectMetaData::EFormatCode, iRequest->Uint32( TMTPTypeRequest::ERequestParameter3 ));
   588         iReceivedObjectP->SetUint(CMTPObjectMetaData::EFormatCode, iRequest->Uint32( TMTPTypeRequest::ERequestParameter3 ));
   567         iPictBridgeDP.PtpServer()->Printer()->DpsDiscovery(iFullPath, &iConnection);
   589         iPictBridgeDP.PtpServer()->Printer()->DpsDiscovery(iFullPath, &iConnection);
   568         TRAPD(err, CreateFsObjectL());
   590         TRAPD(err, CreateFsObjectL());
   569         if ( err != KErrNone )
   591         if ( err != KErrNone )
   570             {
   592             {
   571             __FLOG_1(_L8("Fail to create fs object %d"),err);
   593             OstTrace1( TRACE_WARNING, CMTPPICTBRIDGEDPSENDOBJECTINFO_DOHANDLESENDOBJECTPROPLISTCOMPLETEL, 
       
   594                     "Fail to create fs object %d", err );
   572             SendResponseL(ErrorToMTPError(err));
   595             SendResponseL(ErrorToMTPError(err));
   573             result = EFalse;
   596             result = EFalse;
   574             }
   597             }
   575         else
   598         else
   576             {
   599             {
   577             ReserveObjectL();
   600             ReserveObjectL();
   578             }
   601             }
   579         }
   602         }
   580 
   603 
   581     __FLOG(_L8("<< CMTPPictBridgeDpSendObjectInfo::DoHandleSendObjectPropListCompleteL"));
   604     OstTraceFunctionExit0( CMTPPICTBRIDGEDPSENDOBJECTINFO_DOHANDLESENDOBJECTPROPLISTCOMPLETEL_EXIT );
   582     return result;
   605     return result;
   583     }
   606     }
   584 
   607 
   585 /**
   608 /**
   586 */
   609 */
   587 TBool CMTPPictBridgeDpSendObjectInfo::IsFormatValid(TMTPFormatCode aFormat) const
   610 TBool CMTPPictBridgeDpSendObjectInfo::IsFormatValid(TMTPFormatCode aFormat) const
   588     {
   611     {
   589     __FLOG_VA((_L8(">> CMTPPictGetObjectPropDesc::IsFormatValid %d"),aFormat));
   612     OstTraceFunctionEntry0( CMTPPICTBRIDGEDPSENDOBJECTINFO_ISFORMATVALID_ENTRY );
       
   613     OstTrace1( TRACE_NORMAL, CMTPPICTBRIDGEDPSENDOBJECTINFO_ISFORMATVALID, "aFormat : %d", aFormat );
   590     TInt count(sizeof(KMTPValidCodeExtensionMappings) / sizeof(KMTPValidCodeExtensionMappings[0]));        
   614     TInt count(sizeof(KMTPValidCodeExtensionMappings) / sizeof(KMTPValidCodeExtensionMappings[0]));        
   591     for(TInt i = 0; i < count; i++)
   615     for(TInt i = 0; i < count; i++)
   592         {
   616         {
   593         if (KMTPValidCodeExtensionMappings[i].iFormatCode == aFormat)
   617         if (KMTPValidCodeExtensionMappings[i].iFormatCode == aFormat)
   594             {
   618             {
   595             __FLOG(_L8("<< CMTPPictGetObjectPropDesc::IsFormatValid ETrue"));
   619             OstTraceFunctionExit0( CMTPPICTBRIDGEDPSENDOBJECTINFO_ISFORMATVALID_EXIT );
   596             return ETrue;
   620             return ETrue;
   597             }
   621             }
   598         }
   622         }
   599     __FLOG(_L8("<< CMTPPictGetObjectPropDesc::IsFormatValid EFalse"));
   623     OstTraceFunctionExit0( DUP1_CMTPPICTBRIDGEDPSENDOBJECTINFO_ISFORMATVALID_EXIT );
   600     return EFalse;
   624     return EFalse;
   601     }
   625     }
   602     
   626     
   603 /**
   627 /**
   604 Handling the completing phase of SendObject request
   628 Handling the completing phase of SendObject request
   605 @return ETrue if the object has been successfully saved on the device, otherwise, EFalse
   629 @return ETrue if the object has been successfully saved on the device, otherwise, EFalse
   606 */    
   630 */    
   607 TBool CMTPPictBridgeDpSendObjectInfo::DoHandleSendObjectCompleteL()
   631 TBool CMTPPictBridgeDpSendObjectInfo::DoHandleSendObjectCompleteL()
   608     {
   632     {
   609     __FLOG_VA((_L8(">> CMTPPictGetObjectPropDesc::DoHandleSendObjectCompleteL size=%d cancelled=%d"), iObjectSize, iCancelled));
   633     OstTraceFunctionEntry0( CMTPPICTBRIDGEDPSENDOBJECTINFO_DOHANDLESENDOBJECTCOMPLETEL_ENTRY );
       
   634     OstTraceExt2( TRACE_NORMAL, CMTPPICTBRIDGEDPSENDOBJECTINFO_DOHANDLESENDOBJECTCOMPLETEL, 
       
   635             " size=%d cancelled=%d", iObjectSize, iCancelled );
   610     TBool result(ETrue);
   636     TBool result(ETrue);
   611                 
   637                 
   612     delete iFileReceivedP;
   638     delete iFileReceivedP;
   613     iFileReceivedP = NULL;
   639     iFileReceivedP = NULL;
   614         
   640         
   615     TEntry fileEntry;
   641     TEntry fileEntry;
   616     User::LeaveIfError(iFramework.Fs().Entry(iFullPath, fileEntry));
   642     LEAVEIFERROR(iFramework.Fs().Entry(iFullPath, fileEntry),
       
   643             OstTraceExt2( TRACE_ERROR, DUP2_CMTPPICTBRIDGEDPSENDOBJECTINFO_DOHANDLESENDOBJECTCOMPLETEL, 
       
   644                     "Can't get entry details for %S! error code %d", iFullPath, munged_err ));
   617 
   645 
   618     if (fileEntry.FileSize() != iObjectSize)
   646     if (fileEntry.FileSize() != iObjectSize)
   619         {
   647         {
   620         __FLOG_VA((_L8("   sizes differ %d!=%d"),fileEntry.FileSize(), iObjectSize));
   648         OstTraceExt2( TRACE_NORMAL, DUP1_CMTPPICTBRIDGEDPSENDOBJECTINFO_DOHANDLESENDOBJECTCOMPLETEL, 
       
   649                 "   sizes differ %d!=%d", (TUint32)fileEntry.FileSize(), (TUint32)iObjectSize);
   621         iFramework.RouteRequestUnregisterL(iExpectedSendObjectRequest, iConnection);
   650         iFramework.RouteRequestUnregisterL(iExpectedSendObjectRequest, iConnection);
   622          
   651          
   623         iFramework.Fs().Delete(iFullPath);
   652         iFramework.Fs().Delete(iFullPath);
   624         iFramework.ObjectMgr().UnreserveObjectHandleL(*iReceivedObjectP);
   653         iFramework.ObjectMgr().UnreserveObjectHandleL(*iReceivedObjectP);
   625         TMTPResponseCode responseCode = EMTPRespCodeObjectTooLarge;
   654         TMTPResponseCode responseCode = EMTPRespCodeObjectTooLarge;
   657         //on receiving the corresponding SendObject request.  With Associations however 
   686         //on receiving the corresponding SendObject request.  With Associations however 
   658         //we commit the object straight away as the SendObject phase is often absent 
   687         //we commit the object straight away as the SendObject phase is often absent 
   659         //with folder creation.
   688         //with folder creation.
   660 
   689 
   661 
   690 
   662         TRAPD(err, iFramework.ObjectMgr().CommitReservedObjectHandleL(*iReceivedObjectP));
   691         TRAPD(err, iFramework.ObjectMgr().CommitReservedObjectHandleL(*iReceivedObjectP)); 
   663         __FLOG_VA((_L8(" Entry error %d"),err));        
   692         OstTrace1( TRACE_NORMAL, DUP3_CMTPPICTBRIDGEDPSENDOBJECTINFO_DOHANDLESENDOBJECTCOMPLETEL,  " Entry error %d", err);  
   664         if( KErrAlreadyExists == err )
   693         if( KErrAlreadyExists == err )
   665             {
   694             {
   666             iReceivedObjectP->SetUint(CMTPObjectMetaData::EHandle, iFramework.ObjectMgr().HandleL(iFullPath));
   695             iReceivedObjectP->SetUint(CMTPObjectMetaData::EHandle, iFramework.ObjectMgr().HandleL(iFullPath));
   667             }
   696             }
   668         else 
   697         else 
   669             {
   698             {
   670             User::LeaveIfError(err);
   699             User::LeaveIfError(err);
   671             }
   700             }
   672         SendResponseL(EMTPRespCodeOK);
   701         SendResponseL(EMTPRespCodeOK);
   673         }
   702         }
   674     __FLOG(_L8("<< CMTPPictGetObjectPropDesc::DoHandleSendObjectCompleteL"));
   703     OstTraceFunctionExit0( CMTPPICTBRIDGEDPSENDOBJECTINFO_DOHANDLESENDOBJECTCOMPLETEL_EXIT );
   675     return result;
   704     return result;
   676     }
   705     }
   677 
   706 
   678 /**
   707 /**
   679 Get the full path name of the object to be saved
   708 Get the full path name of the object to be saved
   681 on return, contains the full path name of the object to be saved
   710 on return, contains the full path name of the object to be saved
   682 @return ETrue if the name is valid, EFalse otherwise
   711 @return ETrue if the name is valid, EFalse otherwise
   683 */
   712 */
   684 TBool CMTPPictBridgeDpSendObjectInfo::GetFullPathNameL(const TDesC& aFileName)
   713 TBool CMTPPictBridgeDpSendObjectInfo::GetFullPathNameL(const TDesC& aFileName)
   685     {
   714     {
   686     __FLOG_VA((_L16(">> CMTPPictBridgeDpSendObjectInfo::GetFullPathNameL file %S"), &aFileName));
   715     OstTraceFunctionEntry0( CMTPPICTBRIDGEDPSENDOBJECTINFO_GETFULLPATHNAMEL_ENTRY );
       
   716     OstTraceExt1( TRACE_NORMAL, CMTPPICTBRIDGEDPSENDOBJECTINFO_GETFULLPATHNAMEL, "file %S", aFileName );
       
   717 
   687     TBool result(EFalse);
   718     TBool result(EFalse);
   688     if (aFileName.Length() > 0)
   719     if (aFileName.Length() > 0)
   689         {
   720         {
   690         iFullPath = *iParentSuidP;
   721         iFullPath = *iParentSuidP;
   691         if (iFullPath.Length() + aFileName.Length() < iFullPath.MaxLength())
   722         if (iFullPath.Length() + aFileName.Length() < iFullPath.MaxLength())
   693             iFullPath.Append(aFileName);
   724             iFullPath.Append(aFileName);
   694             result = iFramework.Fs().IsValidName(iFullPath);
   725             result = iFramework.Fs().IsValidName(iFullPath);
   695             }
   726             }
   696         }
   727         }
   697 
   728 
   698     __FLOG_VA((_L16("<< CMTPPictBridgeDpSendObjectInfo::GetFullPathNameL full path %S"), &iFullPath));
   729     OstTraceExt1( TRACE_NORMAL, DUP1_CMTPPICTBRIDGEDPSENDOBJECTINFO_GETFULLPATHNAMEL, "full path %S", iFullPath );
       
   730     OstTraceFunctionExit0( CMTPPICTBRIDGEDPSENDOBJECTINFO_GETFULLPATHNAMEL_EXIT );
   699     return result;
   731     return result;
   700     }
   732     }
   701 
   733 
   702 /**
   734 /**
   703 Check if the object is too large
   735 Check if the object is too large
   709     return ret;
   741     return ret;
   710     }
   742     }
   711     
   743     
   712 TMTPResponseCode CMTPPictBridgeDpSendObjectInfo::VerifyObjectPropListL( TInt& aInvalidParameterIndex )
   744 TMTPResponseCode CMTPPictBridgeDpSendObjectInfo::VerifyObjectPropListL( TInt& aInvalidParameterIndex )
   713     {
   745     {
   714     __FLOG(_L8(">> CMTPPictBridgeDpSendObjectInfo::VerifyObjectPropListL"));
   746     OstTraceFunctionEntry0( CMTPPICTBRIDGEDPSENDOBJECTINFO_VERIFYOBJECTPROPLISTL_ENTRY );
   715     TMTPResponseCode responseCode( EMTPRespCodeOK );
   747     TMTPResponseCode responseCode( EMTPRespCodeOK );
   716     const TUint KCount( iObjectPropList->NumberOfElements() );
   748     const TUint KCount( iObjectPropList->NumberOfElements() );
   717     iObjectPropList->ResetCursor();
   749     iObjectPropList->ResetCursor();
   718     for ( TUint i(0); (i < KCount); i++ )
   750     for ( TUint i(0); (i < KCount); i++ )
   719         {
   751         {
   735             {
   767             {
   736             break;
   768             break;
   737             }  
   769             }  
   738         }
   770         }
   739 
   771 
   740     __FLOG(_L8("<< CMTPPictBridgeDpSendObjectInfo::VerifyObjectPropListL"));
   772     OstTraceFunctionExit0( CMTPPICTBRIDGEDPSENDOBJECTINFO_VERIFYOBJECTPROPLISTL_EXIT );
   741     return responseCode;
   773     return responseCode;
   742     }
   774     }
   743 
   775 
   744 TMTPResponseCode CMTPPictBridgeDpSendObjectInfo::ExtractPropertyL( const CMTPTypeObjectPropListElement& aElement )
   776 TMTPResponseCode CMTPPictBridgeDpSendObjectInfo::ExtractPropertyL( const CMTPTypeObjectPropListElement& aElement )
   745     {
   777     {
   746     __FLOG(_L8(">> CMTPPictBridgeDpSendObjectInfo::ExtractPropertyL"));
   778     OstTraceFunctionEntry0( CMTPPICTBRIDGEDPSENDOBJECTINFO_EXTRACTPROPERTYL_ENTRY );
   747     TMTPResponseCode responseCode(EMTPRespCodeOK);
   779     TMTPResponseCode responseCode(EMTPRespCodeOK);
   748     switch ( aElement.Uint16L(CMTPTypeObjectPropListElement::EPropertyCode) )
   780     switch ( aElement.Uint16L(CMTPTypeObjectPropListElement::EPropertyCode) )
   749         {
   781         {
   750     case EMTPObjectPropCodeObjectFileName:
   782     case EMTPObjectPropCodeObjectFileName:
   751         {
   783         {
   778     	break;
   810     	break;
   779     default:
   811     default:
   780         break;
   812         break;
   781         }
   813         }
   782 
   814 
   783     __FLOG(_L8("<< CMTPPictBridgeDpSendObjectInfo::ExtractPropertyL"));
   815     OstTraceFunctionExit0( CMTPPICTBRIDGEDPSENDOBJECTINFO_EXTRACTPROPERTYL_EXIT );
   784     return responseCode;
   816     return responseCode;
   785     }
   817     }
   786     
   818     
   787 TMTPResponseCode CMTPPictBridgeDpSendObjectInfo::CheckPropCodeL( const CMTPTypeObjectPropListElement& aElement ) const
   819 TMTPResponseCode CMTPPictBridgeDpSendObjectInfo::CheckPropCodeL( const CMTPTypeObjectPropListElement& aElement ) const
   788     {
   820     {
   789     __FLOG(_L8(">> CMTPPictBridgeDpSendObjectInfo::CheckPropCodeL"));
   821     OstTraceFunctionEntry0( CMTPPICTBRIDGEDPSENDOBJECTINFO_CHECKPROPCODEL_ENTRY );
   790     TMTPResponseCode responseCode( EMTPRespCodeOK );
   822     TMTPResponseCode responseCode( EMTPRespCodeOK );
   791     switch( aElement.Uint16L( CMTPTypeObjectPropListElement::EPropertyCode ))
   823     switch( aElement.Uint16L( CMTPTypeObjectPropListElement::EPropertyCode ))
   792         {
   824         {
   793         case EMTPObjectPropCodeStorageID:
   825         case EMTPObjectPropCodeStorageID:
   794             {
   826             {
   873             {
   905             {
   874             responseCode = EMTPRespCodeInvalidObjectPropCode;
   906             responseCode = EMTPRespCodeInvalidObjectPropCode;
   875             }
   907             }
   876             break;
   908             break;
   877         }
   909         }
   878     __FLOG(_L8("<< CMTPPictBridgeDpSendObjectInfo::CheckPropCodeL"));
   910     OstTraceFunctionExit0( CMTPPICTBRIDGEDPSENDOBJECTINFO_CHECKPROPCODEL_EXIT );
   879     return responseCode; 
   911     return responseCode; 
   880     }
   912     }
   881 
   913 
   882 TMTPResponseCode CMTPPictBridgeDpSendObjectInfo::MatchStoreAndParentL() const
   914 TMTPResponseCode CMTPPictBridgeDpSendObjectInfo::MatchStoreAndParentL() const
   883     {
   915     {
   884     __FLOG(_L8(">> CMTPPictBridgeDpSendObjectInfo::MatchStoreAndParentL"));
   916     OstTraceFunctionEntry0( CMTPPICTBRIDGEDPSENDOBJECTINFO_MATCHSTOREANDPARENTL_ENTRY );
   885     TMTPResponseCode ret = EMTPRespCodeOK;
   917     TMTPResponseCode ret = EMTPRespCodeOK;
   886     const TUint32 storeId(Request().Uint32(TMTPTypeRequest::ERequestParameter1));
   918     const TUint32 storeId(Request().Uint32(TMTPTypeRequest::ERequestParameter1));
   887     const TUint32 parentHandle(Request().Uint32(TMTPTypeRequest::ERequestParameter2));
   919     const TUint32 parentHandle(Request().Uint32(TMTPTypeRequest::ERequestParameter2));
   888     if (parentHandle != KMTPHandleAll && parentHandle != KMTPHandleNone)
   920     if (parentHandle != KMTPHandleAll && parentHandle != KMTPHandleNone)
   889         {
   921         {
   893         if (parentObjInfo->Uint(CMTPObjectMetaData::EStorageId) != storeId)   
   925         if (parentObjInfo->Uint(CMTPObjectMetaData::EStorageId) != storeId)   
   894             {
   926             {
   895             ret = EMTPRespCodeInvalidObjectHandle;
   927             ret = EMTPRespCodeInvalidObjectHandle;
   896             }
   928             }
   897         }
   929         }
   898     __FLOG(_L8("<< CMTPPictBridgeDpSendObjectInfo::MatchStoreAndParentL"));
   930     OstTraceFunctionExit0( CMTPPICTBRIDGEDPSENDOBJECTINFO_MATCHSTOREANDPARENTL_EXIT );
   899     return ret;
   931     return ret;
   900     }
   932     }
   901 
   933 
   902 /**
   934 /**
   903 Reserves space for and assigns an object handle to the received object, then
   935 Reserves space for and assigns an object handle to the received object, then
   904 sends a success response.
   936 sends a success response.
   905 */
   937 */
   906 void CMTPPictBridgeDpSendObjectInfo::ReserveObjectL()
   938 void CMTPPictBridgeDpSendObjectInfo::ReserveObjectL()
   907     {
   939     {
   908     __FLOG(_L8(">> CMTPPictBridgeDpSendObjectInfo::ReserveObjectL"));    
   940     OstTraceFunctionEntry0( CMTPPICTBRIDGEDPSENDOBJECTINFO_RESERVEOBJECTL_ENTRY );
   909     iReceivedObjectP->SetUint(CMTPObjectMetaData::EStorageId, iStorageId);
   941     iReceivedObjectP->SetUint(CMTPObjectMetaData::EStorageId, iStorageId);
   910     iReceivedObjectP->SetDesCL(CMTPObjectMetaData::ESuid, iFullPath);
   942     iReceivedObjectP->SetDesCL(CMTPObjectMetaData::ESuid, iFullPath);
   911     
   943     
   912     iFramework.ObjectMgr().ReserveObjectHandleL(*iReceivedObjectP, iObjectSize);    
   944     iFramework.ObjectMgr().ReserveObjectHandleL(*iReceivedObjectP, iObjectSize);    
   913     
   945     
   916     TUint32 parameters[3];
   948     TUint32 parameters[3];
   917     parameters[0] = iStorageId;
   949     parameters[0] = iStorageId;
   918     parameters[1] = iParentHandle;
   950     parameters[1] = iParentHandle;
   919     parameters[2] = iReceivedObjectP->Uint(CMTPObjectMetaData::EHandle);
   951     parameters[2] = iReceivedObjectP->Uint(CMTPObjectMetaData::EHandle);
   920     SendResponseL(EMTPRespCodeOK, (sizeof(parameters) / sizeof(parameters[0])), parameters);
   952     SendResponseL(EMTPRespCodeOK, (sizeof(parameters) / sizeof(parameters[0])), parameters);
   921     __FLOG(_L8("<< CMTPPictBridgeDpSendObjectInfo::ReserveObjectL"));    
   953     OstTraceFunctionExit0( CMTPPICTBRIDGEDPSENDOBJECTINFO_RESERVEOBJECTL_EXIT );
   922     }
   954     }
   923     
   955     
   924 void CMTPPictBridgeDpSendObjectInfo::CreateFsObjectL()
   956 void CMTPPictBridgeDpSendObjectInfo::CreateFsObjectL()
   925     {
   957     {
   926     __FLOG(_L8(">> CMTPPictBridgeDpSendObjectInfo::CreateFsObjectL"));    
   958     OstTraceFunctionEntry0( CMTPPICTBRIDGEDPSENDOBJECTINFO_CREATEFSOBJECTL_ENTRY );
   927     delete iFileReceivedP;
   959     delete iFileReceivedP;
   928     iFileReceivedP = NULL;
   960     iFileReceivedP = NULL;
   929     iFileReceivedP = CMTPTypeFile::NewL(iFramework.Fs(), iFullPath, EFileWrite);
   961     iFileReceivedP = CMTPTypeFile::NewL(iFramework.Fs(), iFullPath, EFileWrite);
   930     iFileReceivedP->SetSizeL(iObjectSize);
   962     iFileReceivedP->SetSizeL(iObjectSize); 
   931     __FLOG(_L8("<< CMTPPictBridgeDpSendObjectInfo::CreateFsObjectL"));    
   963     OstTraceFunctionExit0( CMTPPICTBRIDGEDPSENDOBJECTINFO_CREATEFSOBJECTL_EXIT );
   932     }
   964     }
   933     
   965     
   934 void CMTPPictBridgeDpSendObjectInfo::Rollback()
   966 void CMTPPictBridgeDpSendObjectInfo::Rollback()
   935     {
   967     {
   936     __FLOG(_L8(">> CMTPPictBridgeDpSendObjectInfo::Rollback"));
   968     OstTraceFunctionEntry0( CMTPPICTBRIDGEDPSENDOBJECTINFO_ROLLBACK_ENTRY );
   937     // Delete this object from file system.
   969     // Delete this object from file system.
   938     delete iFileReceivedP;
   970     delete iFileReceivedP;
   939     iFileReceivedP=NULL;
   971     iFileReceivedP=NULL;
   940     TInt err=iFramework.Fs().Delete(iFullPath);
   972     TInt err=iFramework.Fs().Delete(iFullPath);
   941     __FLOG_VA((_L16(">> CMTPPictBridgeDpSendObjectInfo::Rollback deleted %S with return code %d"), &iFullPath, err));
   973     OstTraceExt2( TRACE_NORMAL, CMTPPICTBRIDGEDPSENDOBJECTINFO_ROLLBACK, 
       
   974             "deleted %S with return code %d", iFullPath, err );
   942     TRAP_IGNORE(iFramework.ObjectMgr().UnreserveObjectHandleL(*iReceivedObjectP));
   975     TRAP_IGNORE(iFramework.ObjectMgr().UnreserveObjectHandleL(*iReceivedObjectP));
   943     __FLOG(_L8("<< CMTPPictBridgeDpSendObjectInfo::Rollback"));    
   976     OstTraceFunctionExit0( CMTPPICTBRIDGEDPSENDOBJECTINFO_ROLLBACK_EXIT );
   944     }
   977     }
   945     
   978     
   946 TMTPResponseCode CMTPPictBridgeDpSendObjectInfo::ErrorToMTPError(TInt aError) const
   979 TMTPResponseCode CMTPPictBridgeDpSendObjectInfo::ErrorToMTPError(TInt aError) const
   947     {
   980     {
   948     TMTPResponseCode resp = EMTPRespCodeGeneralError;
   981     TMTPResponseCode resp = EMTPRespCodeGeneralError;