btobexprofiles/obexreceiveservices/bip/src/BIPController.cpp
changeset 70 f5508c13dfe0
parent 67 16e4b9007960
equal deleted inserted replaced
67:16e4b9007960 70:f5508c13dfe0
   354         {
   354         {
   355         // User cancelled the put request, so error the next packet to terminate the put request.
   355         // User cancelled the put request, so error the next packet to terminate the put request.
   356         // BIP considers the Unauthorized error response suitable for this...
   356         // BIP considers the Unauthorized error response suitable for this...
   357         HandleError(ETrue); // reset state and clear up
   357         HandleError(ETrue); // reset state and clear up
   358         return KErrIrObexRespUnauthorized;
   358         return KErrIrObexRespUnauthorized;
       
   359         }
       
   360     
       
   361     // For every packet received, this check is required to ensure that the case where the 
       
   362     // memory card is removed while a transfer is in progress is handled in the right way.
       
   363     TVolumeInfo volInfo;
       
   364     TInt err = iFs.Volume(volInfo, iDrive);
       
   365     if(err != KErrNone)
       
   366         {
       
   367         HandleError(ETrue);
       
   368         return err;
   359         }
   369         }
   360     
   370     
   361     if (iBTObject)
   371     if (iBTObject)
   362         {
   372         {
   363         iTotalSizeByte = iBTObject->Length();     // get size of receiving file
   373         iTotalSizeByte = iBTObject->Length();     // get size of receiving file
   637 TInt CBIPController::HandlePutCompleteIndication()
   647 TInt CBIPController::HandlePutCompleteIndication()
   638 	{
   648 	{
   639     TRACE_FUNC_ENTRY
   649     TRACE_FUNC_ENTRY
   640     TInt retVal = KErrNone;
   650     TInt retVal = KErrNone;
   641 
   651 
       
   652     // Before saving the file received, this check is required to ensure that the case where the 
       
   653     // memory card is removed while a transfer is in progress is handled in the right way.
       
   654     TVolumeInfo volInfo;
       
   655     retVal = iFs.Volume(volInfo, iDrive);
       
   656     if(retVal != KErrNone)
       
   657         {
       
   658         TRACE_ERROR((_L( "[obexreceiveservicebip] CBIPController: HandlePutCompleteIndication error:\t %d" ), retVal ) );              
       
   659         HandleError(ETrue);
       
   660         
       
   661         // Even if the object saving fails we must return image handle with error code
       
   662         TRAP_IGNORE( iBIPImageHandler->AddImageHandleHeaderL( iBTObexServer ) );            
       
   663         
       
   664         TRACE_INFO( _L( "[obexreceiveservicebip] HandlePutCompleteIndication Done\t" ) );
       
   665         
       
   666         delete iBTObject;
       
   667         iBTObject = NULL;
       
   668         
       
   669         delete iBuf;
       
   670         iBuf = NULL;
       
   671         
       
   672         iPreviousDefaultFolder = iDefaultFolder;  // save the last file path where file is successfully saved to file system.
       
   673         iMsvIdParent = KMsvNullIndexEntryId;
       
   674         
       
   675         TRACE_FUNC_EXIT    
       
   676         
       
   677         return retVal;
       
   678         }
       
   679 
   642     iDefaultFolder.Zero();
   680     iDefaultFolder.Zero();
   643     TChar driveLetter;
   681     TChar driveLetter;
   644     if ( iDrive == EDriveC )
   682     if ( iDrive == EDriveC )
   645         {
   683         {
   646         iFs.DriveToChar(iDrive, driveLetter);
   684         iFs.DriveToChar(iDrive, driveLetter);
   665                                                                    iFile,
   703                                                                    iFile,
   666                                                                    iRemoteDeviceName));
   704                                                                    iRemoteDeviceName));
   667     if ( retVal == KErrNone)
   705     if ( retVal == KErrNone)
   668         {
   706         {
   669         TRAP (retVal, TObexUtilsMessageHandler::AddEntryToInboxL(iMsvIdParent, iFullPathFilename));
   707         TRAP (retVal, TObexUtilsMessageHandler::AddEntryToInboxL(iMsvIdParent, iFullPathFilename));
   670         }
   708         
   671     
   709         if( retVal != KErrNone )
   672     
   710             {
   673     if( retVal != KErrNone )
   711             TRACE_ERROR((_L( "[obexreceiveservicebip] CBIPController: HandlePutCompleteIndication error:\t %d" ), retVal ) );              
   674         {
   712             TRAP( retVal, TObexUtilsMessageHandler::RemoveInboxEntriesL(iBTObject, iMsvIdParent));
   675         TRACE_ERROR((_L( "[obexreceiveservicebip] CBIPController: HandlePutCompleteIndication error:\t %d" ), retVal ) );              
   713             retVal = KErrDiskFull;
   676         TRAP( retVal, TObexUtilsMessageHandler::RemoveInboxEntriesL(iBTObject, iMsvIdParent));
   714             }
   677         retVal = KErrDiskFull;
   715         }
   678         }
   716     
   679     // Even if the object saving fails we must return image handle with error code
   717     // Even if the object saving fails we must return image handle with error code
   680     TRAP_IGNORE( iBIPImageHandler->AddImageHandleHeaderL( iBTObexServer ) );            
   718     TRAP_IGNORE( iBIPImageHandler->AddImageHandleHeaderL( iBTObexServer ) );            
   681     TRACE_INFO( _L( "[obexreceiveservicebip] HandlePutCompleteIndication Done\t" ) );
   719     TRACE_INFO( _L( "[obexreceiveservicebip] HandlePutCompleteIndication Done\t" ) );
   682     delete iBTObject;
   720     delete iBTObject;
   683     iBTObject = NULL;
   721     iBTObject = NULL;