diff -r 16e4b9007960 -r f5508c13dfe0 btobexprofiles/obexreceiveservices/bip/src/BIPController.cpp --- a/btobexprofiles/obexreceiveservices/bip/src/BIPController.cpp Wed Oct 13 13:15:31 2010 +0300 +++ b/btobexprofiles/obexreceiveservices/bip/src/BIPController.cpp Tue Oct 19 15:09:34 2010 +0300 @@ -358,6 +358,16 @@ return KErrIrObexRespUnauthorized; } + // For every packet received, this check is required to ensure that the case where the + // memory card is removed while a transfer is in progress is handled in the right way. + TVolumeInfo volInfo; + TInt err = iFs.Volume(volInfo, iDrive); + if(err != KErrNone) + { + HandleError(ETrue); + return err; + } + if (iBTObject) { iTotalSizeByte = iBTObject->Length(); // get size of receiving file @@ -639,6 +649,34 @@ TRACE_FUNC_ENTRY TInt retVal = KErrNone; + // Before saving the file received, this check is required to ensure that the case where the + // memory card is removed while a transfer is in progress is handled in the right way. + TVolumeInfo volInfo; + retVal = iFs.Volume(volInfo, iDrive); + if(retVal != KErrNone) + { + TRACE_ERROR((_L( "[obexreceiveservicebip] CBIPController: HandlePutCompleteIndication error:\t %d" ), retVal ) ); + HandleError(ETrue); + + // Even if the object saving fails we must return image handle with error code + TRAP_IGNORE( iBIPImageHandler->AddImageHandleHeaderL( iBTObexServer ) ); + + TRACE_INFO( _L( "[obexreceiveservicebip] HandlePutCompleteIndication Done\t" ) ); + + delete iBTObject; + iBTObject = NULL; + + delete iBuf; + iBuf = NULL; + + iPreviousDefaultFolder = iDefaultFolder; // save the last file path where file is successfully saved to file system. + iMsvIdParent = KMsvNullIndexEntryId; + + TRACE_FUNC_EXIT + + return retVal; + } + iDefaultFolder.Zero(); TChar driveLetter; if ( iDrive == EDriveC ) @@ -667,15 +705,15 @@ if ( retVal == KErrNone) { TRAP (retVal, TObexUtilsMessageHandler::AddEntryToInboxL(iMsvIdParent, iFullPathFilename)); + + if( retVal != KErrNone ) + { + TRACE_ERROR((_L( "[obexreceiveservicebip] CBIPController: HandlePutCompleteIndication error:\t %d" ), retVal ) ); + TRAP( retVal, TObexUtilsMessageHandler::RemoveInboxEntriesL(iBTObject, iMsvIdParent)); + retVal = KErrDiskFull; + } } - - if( retVal != KErrNone ) - { - TRACE_ERROR((_L( "[obexreceiveservicebip] CBIPController: HandlePutCompleteIndication error:\t %d" ), retVal ) ); - TRAP( retVal, TObexUtilsMessageHandler::RemoveInboxEntriesL(iBTObject, iMsvIdParent)); - retVal = KErrDiskFull; - } // Even if the object saving fails we must return image handle with error code TRAP_IGNORE( iBIPImageHandler->AddImageHandleHeaderL( iBTObexServer ) ); TRACE_INFO( _L( "[obexreceiveservicebip] HandlePutCompleteIndication Done\t" ) );