btobexprofiles/obexreceiveservices/opp/src/oppcontroller.cpp
changeset 70 f5508c13dfe0
parent 67 16e4b9007960
equal deleted inserted replaced
67:16e4b9007960 70:f5508c13dfe0
   321         // User cancelled the put request, so error the next packet to terminate the put request.
   321         // User cancelled the put request, so error the next packet to terminate the put request.
   322         // BIP considers the Unauthorized error response suitable for this...
   322         // BIP considers the Unauthorized error response suitable for this...
   323         HandleError(ETrue); // reset state and clear up
   323         HandleError(ETrue); // reset state and clear up
   324         return KErrIrObexRespUnauthorized;
   324         return KErrIrObexRespUnauthorized;
   325         }
   325         }
       
   326 
       
   327     // For every packet received, this check is required to ensure that the case where the 
       
   328     // memory card is removed while a transfer is in progress is handled in the right way.
       
   329     TVolumeInfo volInfo;
       
   330     TInt err = iFs.Volume(volInfo, iDrive);
       
   331     if(err != KErrNone)
       
   332         {
       
   333         HandleError(ETrue);
       
   334         return err;
       
   335         }
   326     
   336     
   327     iTotalSizeByte = iObexObject->Length();     // get size of receiving file
   337     iTotalSizeByte = iObexObject->Length();     // get size of receiving file
   328     iReceivingFileName = iObexObject->Name();   // get name of receiving file
   338     iReceivingFileName = iObexObject->Name();   // get name of receiving file
   329     
   339     
   330     // Check that capacity is suitable as soon as possible
   340     // Check that capacity is suitable as soon as possible
   572 //
   582 //
   573 TInt COPPController::HandlePutCompleteIndication()
   583 TInt COPPController::HandlePutCompleteIndication()
   574 	{
   584 	{
   575 	TRACE_FUNC        
   585 	TRACE_FUNC        
   576     TInt retVal = KErrNone;
   586     TInt retVal = KErrNone;
       
   587 
       
   588     // Before saving the file received, this check is required to ensure that the case where the 
       
   589     // memory card is removed while a transfer is in progress is handled in the right way.
       
   590     TVolumeInfo volInfo;
       
   591     retVal = iFs.Volume(volInfo, iDrive);
       
   592     if(retVal != KErrNone)
       
   593         {
       
   594         TRACE_INFO( (_L( "[oppreceiveservice] HandlePutCompleteIndication failed  %d \t" ),retVal ) ); 
       
   595 
       
   596         HandleError(ETrue);
       
   597         delete iObexObject;
       
   598         iObexObject = NULL;
       
   599 
       
   600         delete iBuf;
       
   601         iBuf = NULL;
       
   602         
       
   603         iPreviousDefaultFolder = iDefaultFolder;  // save the last file path where file is successfully saved to file system.
       
   604         iMsvIdParent = KMsvNullIndexEntryId; 
       
   605         TRACE_INFO( _L( "[oppreceiveservice] HandlePutCompleteIndication Done\t" ) );    
       
   606         return retVal;
       
   607         }
   577 
   608 
   578 	TChar driveLetter;
   609 	TChar driveLetter;
   579 	iDefaultFolder.Zero();
   610 	iDefaultFolder.Zero();
   580 	iFs.DriveToChar(iDrive, driveLetter);
   611 	iFs.DriveToChar(iDrive, driveLetter);
   581 	iDefaultFolder.Append(driveLetter);
   612 	iDefaultFolder.Append(driveLetter);