mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/src/csendobject.cpp
branchRCL_3
changeset 9 bee149131e4b
parent 0 a2952bb97e68
child 14 05b0d2323768
equal deleted inserted replaced
4:d45095c2f4f3 9:bee149131e4b
    17 
    17 
    18 
    18 
    19 #include <mtp/mmtpdataproviderframework.h>
    19 #include <mtp/mmtpdataproviderframework.h>
    20 #include <mtp/mmtpobjectmgr.h>
    20 #include <mtp/mmtpobjectmgr.h>
    21 #include <mtp/cmtptypestring.h>
    21 #include <mtp/cmtptypestring.h>
    22 #include <mtp/cmtptypearray.h>
       
    23 #include <mtp/cmtptypeobjectinfo.h>
    22 #include <mtp/cmtptypeobjectinfo.h>
    24 #include <mtp/cmtptypefile.h>
    23 #include <mtp/cmtptypefile.h>
    25 #include <mtp/mmtpstoragemgr.h>
    24 #include <mtp/mmtpstoragemgr.h>
    26 #include <mtp/cmtpobjectmetadata.h>
    25 #include <mtp/cmtpobjectmetadata.h>
    27 #include <bautils.h>
    26 #include <bautils.h>
    30 #include "csendobject.h"
    29 #include "csendobject.h"
    31 #include "mmmtpdpconfig.h"
    30 #include "mmmtpdpconfig.h"
    32 #include "mmmtpdputility.h"
    31 #include "mmmtpdputility.h"
    33 #include "tmmmtpdppanic.h"
    32 #include "tmmmtpdppanic.h"
    34 #include "mmmtpdplogger.h"
    33 #include "mmmtpdplogger.h"
       
    34 #include "cpropertysettingutility.h"
    35 #include "cmmmtpdpmetadataaccesswrapper.h"
    35 #include "cmmmtpdpmetadataaccesswrapper.h"
    36 
    36 
    37 // Verification data for the SendObjectInfo request
    37 // Verification data for the SendObjectInfo request
    38 const TMTPRequestElementInfo KMTPSendObjectInfoPolicy[] =
    38 const TMTPRequestElementInfo KMTPSendObjectInfoPolicy[] =
    39     {
    39     {
    55         KMTPHandleNone
    55         KMTPHandleNone
    56         }
    56         }
    57     };
    57     };
    58 
    58 
    59 // -----------------------------------------------------------------------------
    59 // -----------------------------------------------------------------------------
       
    60 // CSendObject::NewL
       
    61 // Two-phase construction method
       
    62 // -----------------------------------------------------------------------------
       
    63 //
       
    64 EXPORT_C MMmRequestProcessor* CSendObject::NewL( MMTPDataProviderFramework& aFramework,
       
    65     MMTPConnection& aConnection,
       
    66     MMmMtpDpConfig& aDpConfig )
       
    67     {
       
    68     CSendObject* self = new ( ELeave ) CSendObject( aFramework, aConnection, aDpConfig );
       
    69 
       
    70     CleanupStack::PushL(self);
       
    71     self->ConstructL();
       
    72     CleanupStack::Pop(self);
       
    73 
       
    74     return self;
       
    75     }
       
    76 
       
    77 // -----------------------------------------------------------------------------
    60 // CSendObject::~CSendObject
    78 // CSendObject::~CSendObject
    61 // Destructor
    79 // Destructor
    62 // -----------------------------------------------------------------------------
    80 // -----------------------------------------------------------------------------
    63 //
    81 //
    64 EXPORT_C CSendObject::~CSendObject()
    82 EXPORT_C CSendObject::~CSendObject()
    86 // -----------------------------------------------------------------------------
   104 // -----------------------------------------------------------------------------
    87 // CSendObject::CSendObject
   105 // CSendObject::CSendObject
    88 // Standard C++ Constructor
   106 // Standard C++ Constructor
    89 // -----------------------------------------------------------------------------
   107 // -----------------------------------------------------------------------------
    90 //
   108 //
    91 EXPORT_C CSendObject::CSendObject( MMTPDataProviderFramework& aFramework,
   109 CSendObject::CSendObject( MMTPDataProviderFramework& aFramework,
    92     MMTPConnection& aConnection,
   110     MMTPConnection& aConnection,
    93     MMmMtpDpConfig& aDpConfig ) :
   111     MMmMtpDpConfig& aDpConfig ) :
    94         CRequestProcessor( aFramework, aConnection, 0, NULL),
   112         CRequestProcessor( aFramework, aConnection, 0, NULL),
    95         iFs( iFramework.Fs() ),
   113         iFs( iFramework.Fs() ),
    96         iObjectMgr( iFramework.ObjectMgr() ),
   114         iObjectMgr( iFramework.ObjectMgr() ),
   102 // -----------------------------------------------------------------------------
   120 // -----------------------------------------------------------------------------
   103 // CSendObject::ConstructL
   121 // CSendObject::ConstructL
   104 // 2nd Phase Constructor
   122 // 2nd Phase Constructor
   105 // -----------------------------------------------------------------------------
   123 // -----------------------------------------------------------------------------
   106 //
   124 //
   107 EXPORT_C void CSendObject::ConstructL()
   125 void CSendObject::ConstructL()
   108     {
   126     {
   109     PRINT( _L( "MM MTP => CSendObject::ConstructL" ) );
   127     PRINT( _L( "MM MTP => CSendObject::ConstructL" ) );
   110 
   128 
   111     iExpectedSendObjectRequest.SetUint16( TMTPTypeRequest::ERequestOperationCode,
   129     iExpectedSendObjectRequest.SetUint16( TMTPTypeRequest::ERequestOperationCode,
   112         EMTPOpCodeSendObject );
   130         EMTPOpCodeSendObject );
   566     delete iFileReceived;
   584     delete iFileReceived;
   567     iFileReceived = NULL;
   585     iFileReceived = NULL;
   568 
   586 
   569     TEntry fileEntry;
   587     TEntry fileEntry;
   570     User::LeaveIfError( iFs.Entry( iFullPath, fileEntry ) );
   588     User::LeaveIfError( iFs.Entry( iFullPath, fileEntry ) );
   571     if ( fileEntry.iSize != iObjectSize )
   589     if ( fileEntry.FileSize() != iObjectSize )
   572         {
   590         {
   573         iFs.Delete( iFullPath );
   591         iFs.Delete( iFullPath );
   574         iObjectMgr.UnreserveObjectHandleL( *iReceivedObjectInfo );
   592         iObjectMgr.UnreserveObjectHandleL( *iReceivedObjectInfo );
   575         TMTPResponseCode responseCode = EMTPRespCodeObjectTooLarge;
   593         TMTPResponseCode responseCode = EMTPRespCodeObjectTooLarge;
   576         if ( fileEntry.iSize < iObjectSize )
   594         if ( fileEntry.FileSize() < iObjectSize )
   577             {
   595             {
   578             responseCode = EMTPRespCodeIncompleteTransfer;
   596             responseCode = EMTPRespCodeIncompleteTransfer;
   579             }
   597             }
   580         SendResponseL( responseCode );
   598         SendResponseL( responseCode );
   581         result = EFalse;
   599         result = EFalse;
   682             {
   700             {
   683             break;
   701             break;
   684             }
   702             }
   685         }
   703         }
   686 
   704 
   687     PRINT1( _L( "MM MTP <= CSendObject::VerifyObjectPropListL, responseCode = 0x%X" ), responseCode );
   705     PRINT1( _L( "MM MTP <= CSendObject::VerifyObjectPropListL, responseCode = 0x%x" ), responseCode );
   688     return responseCode;
   706     return responseCode;
   689     }
   707     }
   690 
   708 
   691 // -----------------------------------------------------------------------------
   709 // -----------------------------------------------------------------------------
   692 // Validates the data type for a given property code.
   710 // Validates the data type for a given property code.
   701 
   719 
   702     // Checking if the propCode is supported first then check its type
   720     // Checking if the propCode is supported first then check its type
   703     const RArray<TUint>* properties = iDpConfig.GetSupportedPropertiesL( iObjectFormat );
   721     const RArray<TUint>* properties = iDpConfig.GetSupportedPropertiesL( iObjectFormat );
   704     TUint16 propCode = aElement.Uint16L( CMTPTypeObjectPropListElement::EPropertyCode );
   722     TUint16 propCode = aElement.Uint16L( CMTPTypeObjectPropListElement::EPropertyCode );
   705     TUint16 dataType = aElement.Uint16L( CMTPTypeObjectPropListElement::EDatatype );
   723     TUint16 dataType = aElement.Uint16L( CMTPTypeObjectPropListElement::EDatatype );
   706     PRINT2( _L( "MM MTP => CSendObject::CheckPropCodeL propCode = 0x%X, dataType = 0x%X" ), propCode, dataType );
   724     PRINT2( _L( "MM MTP => CSendObject::CheckPropCodeL propCode = 0x%x, dataType = 0x%x" ), propCode, dataType );
   707 
   725 
   708     responseCode = EMTPRespCodeInvalidObjectPropCode;
   726     responseCode = EMTPRespCodeInvalidObjectPropCode;
   709     const TInt count = properties->Count();
   727     const TInt count = properties->Count();
   710     for ( TInt i = 0; i < count; i++ )
   728     for ( TInt i = 0; i < count; i++ )
   711         {
   729         {
   783                 responseCode = EMTPRespCodeInvalidObjectPropFormat;
   801                 responseCode = EMTPRespCodeInvalidObjectPropFormat;
   784                 }
   802                 }
   785             break;
   803             break;
   786 
   804 
   787         case EMTPObjectPropCodeDateCreated:
   805         case EMTPObjectPropCodeDateCreated:
   788             // TODO: this property is read-only, should response EMTPRespCodeAccessDenied or set nothing?
       
   789         case EMTPObjectPropCodeDateModified:
   806         case EMTPObjectPropCodeDateModified:
   790         case EMTPObjectPropCodeObjectFileName:
   807         case EMTPObjectPropCodeObjectFileName:
   791         case EMTPObjectPropCodeName:
   808         case EMTPObjectPropCodeName:
   792             if ( dataType != EMTPTypeString )
   809             if ( dataType != EMTPTypeString )
   793                 {
   810                 {
   803             break;
   820             break;
   804 
   821 
   805         default:
   822         default:
   806             // check types of DP specific properties
   823             // check types of DP specific properties
   807             // TODO: Is there anything except datatype need to be checked?
   824             // TODO: Is there anything except datatype need to be checked?
   808             responseCode = CheckSepecificPropType( propCode, dataType );
   825             responseCode = MmMtpDpUtility::CheckPropType( propCode, dataType );
   809             break;
   826             if ( responseCode == EMTPRespCodeAccessDenied )
   810         }
   827                 {
   811 
   828                 responseCode = EMTPRespCodeOK;
   812     PRINT1( _L( "MM MTP <= CSendObject::CheckPropCode, responseCode = 0x%X" ), responseCode );
   829                 }
       
   830             break;
       
   831         }
       
   832 
       
   833     PRINT1( _L( "MM MTP <= CSendObject::CheckPropCode, responseCode = 0x%x" ), responseCode );
   813     return responseCode;
   834     return responseCode;
   814     }
   835     }
   815 
   836 
   816 // -----------------------------------------------------------------------------
   837 // -----------------------------------------------------------------------------
   817 // Extracts the file information from the object property list element
   838 // Extracts the file information from the object property list element
   856         default:
   877         default:
   857             // Only extract necessary properties which conform to SendObjectInfo.
   878             // Only extract necessary properties which conform to SendObjectInfo.
   858             break;
   879             break;
   859         }
   880         }
   860 
   881 
   861     PRINT1( _L( "MM MTP <= CSendObject::ExtractPropertyL, responseCode = 0x%X" ), responseCode );
   882     PRINT1( _L( "MM MTP <= CSendObject::ExtractPropertyL, responseCode = 0x%x" ), responseCode );
   862     return responseCode;
   883     return responseCode;
   863     }
   884     }
   864 
   885 
   865 // -----------------------------------------------------------------------------
   886 // -----------------------------------------------------------------------------
   866 // CSendObject::SetObjectPropListL
   887 // CSendObject::SetObjectPropListL
   886 
   907 
   887         switch ( propertyCode )
   908         switch ( propertyCode )
   888             {
   909             {
   889             case EMTPObjectPropCodeStorageID:
   910             case EMTPObjectPropCodeStorageID:
   890             case EMTPObjectPropCodeObjectFormat:
   911             case EMTPObjectPropCodeObjectFormat:
   891             case EMTPObjectPropCodeProtectionStatus:
       
   892             case EMTPObjectPropCodeObjectSize:
   912             case EMTPObjectPropCodeObjectSize:
   893             case EMTPObjectPropCodeParentObject:
   913             case EMTPObjectPropCodeParentObject:
   894             case EMTPObjectPropCodePersistentUniqueObjectIdentifier:
   914             case EMTPObjectPropCodePersistentUniqueObjectIdentifier:
   895                 // Do nothing for those properties are already set.
   915                 // Do nothing for those properties are already set.
   896                 break;
   916                 break;
   897 
   917 
   898             case EMTPObjectPropCodeNonConsumable:
   918             case EMTPObjectPropCodeNonConsumable:
       
   919                 iReceivedObjectInfo->SetUint( CMTPObjectMetaData::ENonConsumable,
       
   920                     element.Uint8L( CMTPTypeObjectPropListElement::EValue ) );
       
   921                 break;
       
   922 
   899             case EMTPObjectPropCodeDateAdded:
   923             case EMTPObjectPropCodeDateAdded:
   900             case EMTPObjectPropCodeDateCreated:
   924             case EMTPObjectPropCodeDateCreated:
   901             case EMTPObjectPropCodeDateModified:
   925             case EMTPObjectPropCodeDateModified:
   902             case EMTPObjectPropCodeObjectFileName:
   926             case EMTPObjectPropCodeObjectFileName:
   903                 // TODO: Does anything need to be done on these read-only properties?
   927                 // TODO: Does anything need to be done on these read-only properties?
   906                  * should accept values during object creation by
   930                  * should accept values during object creation by
   907                  * way of the SendObjectPropList command.
   931                  * way of the SendObjectPropList command.
   908                  */
   932                  */
   909                 break;
   933                 break;
   910 
   934 
       
   935             case EMTPObjectPropCodeProtectionStatus:
       
   936                 SetProtectionStatusL();
       
   937                 break;
       
   938 
   911             case EMTPObjectPropCodeName:
   939             case EMTPObjectPropCodeName:
   912                 {
   940                 {
   913                 CMTPTypeString* stringData = CMTPTypeString::NewLC( element.StringL( CMTPTypeObjectPropListElement::EValue ) );// + stringData
   941                 CMTPTypeString* stringData = CMTPTypeString::NewLC( element.StringL( CMTPTypeObjectPropListElement::EValue ) );// + stringData
   914 
   942 
   915                 responseCode = SetMetaDataToWrapperL( propertyCode,
   943                 responseCode = iDpConfig.PropSettingUtility()->SetMetaDataToWrapperL( iDpConfig,
       
   944                     propertyCode,
   916                     *stringData,
   945                     *stringData,
   917                     *iReceivedObjectInfo );
   946                     *iReceivedObjectInfo );
   918 
   947 
   919                 CleanupStack::PopAndDestroy( stringData );// - stringData
   948                 CleanupStack::PopAndDestroy( stringData );// - stringData
   920                 }
   949                 }
   921                 break;
   950                 break;
   922 
   951 
   923             default:
   952             default:
   924                 {
   953                 {
   925                 responseCode = SetSpecificObjectPropertyL( propertyCode,
   954                 responseCode = iDpConfig.PropSettingUtility()->SetSpecificObjectPropertyL( iDpConfig,
       
   955                     propertyCode,
   926                     *iReceivedObjectInfo,
   956                     *iReceivedObjectInfo,
   927                     element );
   957                     element );
   928                 }
   958                 }
   929                 break;
   959                 break;
   930             } // end of switch
   960             } // end of switch
   933     PRINT1( _L( "MM MTP <= CSendObject::SetObjectPropListL responseCode = 0x%x" ), responseCode );
   963     PRINT1( _L( "MM MTP <= CSendObject::SetObjectPropListL responseCode = 0x%x" ), responseCode );
   934     return responseCode;
   964     return responseCode;
   935     }
   965     }
   936 
   966 
   937 // -----------------------------------------------------------------------------
   967 // -----------------------------------------------------------------------------
   938 // CSendObject::SetMetaDataToWrapperL
       
   939 //
       
   940 // -----------------------------------------------------------------------------
       
   941 //
       
   942 EXPORT_C TMTPResponseCode CSendObject::SetMetaDataToWrapperL( const TUint16 aPropCode,
       
   943     MMTPType& aNewData,
       
   944     const CMTPObjectMetaData& aObjectMetaData )
       
   945     {
       
   946     TMTPResponseCode resCode = EMTPRespCodeOK;
       
   947     TRAPD( err, iDpConfig.GetWrapperL().SetObjectMetadataValueL( aPropCode,
       
   948             aNewData,
       
   949             aObjectMetaData ) );
       
   950 
       
   951     PRINT1( _L("MM MTP <> CSendObject::SetMetaDataToWrapperL err = %d"), err);
       
   952 
       
   953     if ( err == KErrNone )
       
   954         {
       
   955         resCode = EMTPRespCodeOK;
       
   956         }
       
   957     else if ( err == KErrTooBig )
       
   958     // according to the codes of S60
       
   959         {
       
   960         resCode = EMTPRespCodeInvalidDataset;
       
   961         }
       
   962     else if ( err == KErrPermissionDenied )
       
   963         {
       
   964         resCode = EMTPRespCodeAccessDenied;
       
   965         }
       
   966     else if ( err == KErrNotFound )
       
   967         {
       
   968         if ( MmMtpDpUtility::HasMetadata( aObjectMetaData.Uint( CMTPObjectMetaData::EFormatCode ) ) )
       
   969             SendResponseL( EMTPRespCodeAccessDenied );
       
   970         }
       
   971     else
       
   972         {
       
   973         err = HandleSpecificWrapperError( err, aObjectMetaData );
       
   974 
       
   975         if ( err != KErrNone )
       
   976             resCode = EMTPRespCodeGeneralError;
       
   977         }
       
   978 
       
   979     PRINT1( _L( "MM MTP <= CSendObject::SetMetaDataToWrapperL resCode = 0x%x" ), resCode );
       
   980 
       
   981     return resCode;
       
   982     }
       
   983 
       
   984 // -----------------------------------------------------------------------------
       
   985 // CSendObject::MatchStoreAndParentL
   968 // CSendObject::MatchStoreAndParentL
   986 // -----------------------------------------------------------------------------
   969 // -----------------------------------------------------------------------------
   987 //
   970 //
   988 TMTPResponseCode CSendObject::MatchStoreAndParentL()
   971 TMTPResponseCode CSendObject::MatchStoreAndParentL()
   989     {
   972     {
   990     TMTPResponseCode responseCode = EMTPRespCodeOK;
   973     TMTPResponseCode responseCode = EMTPRespCodeOK;
   991 
   974 
   992     iStorageId = Request().Uint32( TMTPTypeRequest::ERequestParameter1 );
   975     iStorageId = Request().Uint32( TMTPTypeRequest::ERequestParameter1 );
   993     iParentHandle = Request().Uint32( TMTPTypeRequest::ERequestParameter2 );
   976     iParentHandle = Request().Uint32( TMTPTypeRequest::ERequestParameter2 );
   994     PRINT2( _L( "MM MTP <> CSendObject::MatchStoreAndParentL, iStorageId = 0x%X, iParentHandle = 0x%X" ),
   977     PRINT2( _L( "MM MTP <> CSendObject::MatchStoreAndParentL, iStorageId = 0x%x, iParentHandle = 0x%x" ),
   995         iStorageId,
   978         iStorageId,
   996         iParentHandle );
   979         iParentHandle );
   997 
   980 
   998     if ( iStorageId == KMTPStorageDefault )
   981     if ( iStorageId == KMTPStorageDefault )
   999         {
   982         {
  1000         iStorageId = iDpConfig.GetDefaultStorageIdL();
   983         iStorageId = iDpConfig.GetDefaultStorageIdL();
  1001         PRINT1( _L( "MM MTP <> CSendObject::GetDefaultStorageIdL, iStorageId = 0x%X" ), iStorageId );
   984         PRINT1( _L( "MM MTP <> CSendObject::GetDefaultStorageIdL, iStorageId = 0x%x" ), iStorageId );
  1002         }
   985         }
  1003 
   986 
  1004     delete iParentSuid;
   987     delete iParentSuid;
  1005     iParentSuid = NULL;
   988     iParentSuid = NULL;
  1006 
   989 
  1044 // CSendObject::IsTooLarge
  1027 // CSendObject::IsTooLarge
  1045 // Check if the object is too large
  1028 // Check if the object is too large
  1046 // @return ETrue if yes, otherwise EFalse
  1029 // @return ETrue if yes, otherwise EFalse
  1047 // -----------------------------------------------------------------------------
  1030 // -----------------------------------------------------------------------------
  1048 //
  1031 //
  1049 TBool CSendObject::IsTooLarge( TUint32 aObjectSize ) const
  1032 TBool CSendObject::IsTooLarge( TUint64 aObjectSize ) const
  1050     {
  1033     {
  1051     TBool ret = ( aObjectSize > KMaxTInt );
  1034     const TUint64 KMaxSupportedFileSize = 0xFFFFFFFF; //Maximal file size supported (4GB-1)
  1052     PRINT2( _L( "MM MTP <> CSendObject::IsTooLarge aObjectSize = %d, ret = %d" ), aObjectSize, ret );
  1035     TBool ret = ( aObjectSize > KMaxSupportedFileSize );
       
  1036     PRINT2( _L( "MM MTP <> CSendObject::IsTooLarge aObjectSize = 0x%Lx, ret = %d" ), aObjectSize, ret );
  1053     return ret;
  1037     return ret;
  1054     }
  1038     }
  1055 
  1039 
  1056 // -----------------------------------------------------------------------------
  1040 // -----------------------------------------------------------------------------
  1057 // CSendObject::CanStoreFileL
  1041 // CSendObject::CanStoreFileL
  1178     if ( err != KErrNone )
  1162     if ( err != KErrNone )
  1179         PRINT1( _L( "MM MTP <> CSendObject::ReserveObjectL err = %d" ), err );
  1163         PRINT1( _L( "MM MTP <> CSendObject::ReserveObjectL err = %d" ), err );
  1180     if ( iObjectSize == 0 )
  1164     if ( iObjectSize == 0 )
  1181         {
  1165         {
  1182         SaveEmptyFileL();
  1166         SaveEmptyFileL();
       
  1167         SetObjectPropListL( *iObjectPropList );
  1183         iObjectMgr.CommitReservedObjectHandleL( *iReceivedObjectInfo );
  1168         iObjectMgr.CommitReservedObjectHandleL( *iReceivedObjectInfo );
  1184         }
  1169         }
  1185 
  1170 
  1186     iExpectedSendObjectRequest.SetUint32( TMTPTypeRequest::ERequestSessionID,
  1171     iExpectedSendObjectRequest.SetUint32( TMTPTypeRequest::ERequestSessionID,
  1187         iSessionId );
  1172         iSessionId );
  1209         {
  1194         {
  1210         // TODO: wait for review
  1195         // TODO: wait for review
  1211         TInt err = KErrNone;
  1196         TInt err = KErrNone;
  1212         if ( iProtectionStatus == EMTPProtectionNoProtection )
  1197         if ( iProtectionStatus == EMTPProtectionNoProtection )
  1213             {
  1198             {
  1214             iFs.SetAtt( iFullPath, KEntryAttNormal, KEntryAttReadOnly );
  1199             err = iFs.SetAtt( iFullPath, KEntryAttNormal, KEntryAttReadOnly );
  1215             }
  1200             }
  1216         else
  1201         else
  1217             {
  1202             {
  1218             iFs.SetAtt( iFullPath, KEntryAttReadOnly, KEntryAttNormal );
  1203             err = iFs.SetAtt( iFullPath, KEntryAttReadOnly, KEntryAttNormal );
  1219             }
  1204             }
  1220         User::LeaveIfError( err );
  1205         User::LeaveIfError( err );
  1221         }
  1206         }
  1222     PRINT( _L( "MM MTP <= CSendObject::SetProtectionStatusL" ) );
  1207     PRINT( _L( "MM MTP <= CSendObject::SetProtectionStatusL" ) );
  1223     }
  1208     }
  1238     SetProtectionStatusL();
  1223     SetProtectionStatusL();
  1239 
  1224 
  1240     // add playlist to MPX DB
  1225     // add playlist to MPX DB
  1241     TParsePtrC parse( iFullPath );
  1226     TParsePtrC parse( iFullPath );
  1242     iDpConfig.GetWrapperL().SetStorageRootL( parse.Drive() );
  1227     iDpConfig.GetWrapperL().SetStorageRootL( parse.Drive() );
  1243     iDpConfig.GetWrapperL().AddObjectL( iFullPath );
  1228     iDpConfig.GetWrapperL().AddObjectL( iFullPath, iObjectFormat, EMTPSubFormatCodeUnknown );
  1244 
  1229 
  1245     if ( EMTPFormatCodeAbstractAudioVideoPlaylist == iObjectFormat )
  1230     if ( EMTPFormatCodeAbstractAudioVideoPlaylist == iObjectFormat )
  1246         {
  1231         {
  1247         TInt err = KErrNone;
  1232         TInt err = KErrNone;
  1248         err = iFs.SetAtt( iFullPath,
  1233         err = iFs.SetAtt( iFullPath,
  1264 void CSendObject::AddMediaToStoreL()
  1249 void CSendObject::AddMediaToStoreL()
  1265     {
  1250     {
  1266     PRINT( _L( "MM MTP => CSendObject::AddMediaToStoreL" ) );
  1251     PRINT( _L( "MM MTP => CSendObject::AddMediaToStoreL" ) );
  1267 
  1252 
  1268     TBool isVideo = EFalse;
  1253     TBool isVideo = EFalse;
       
  1254     TMmMtpSubFormatCode subFormatCode;
  1269     switch ( iObjectFormat )
  1255     switch ( iObjectFormat )
  1270         {
  1256         {
  1271         case EMTPFormatCode3GPContainer:
  1257         case EMTPFormatCode3GPContainer:
  1272         case EMTPFormatCodeMP4Container:
  1258         case EMTPFormatCodeMP4Container:
  1273         case EMTPFormatCodeASF:
  1259         case EMTPFormatCodeASF:
  1274             {
  1260             {
  1275             TMmMtpSubFormatCode subFormatCode;
       
  1276 
  1261 
  1277             if ( MmMtpDpUtility::IsVideoL( iFullPath ) )
  1262             if ( MmMtpDpUtility::IsVideoL( iFullPath ) )
  1278                 {
  1263                 {
  1279                 subFormatCode = EMTPSubFormatCodeVideo;
  1264                 subFormatCode = EMTPSubFormatCodeVideo;
  1280                 isVideo = ETrue;
  1265                 isVideo = ETrue;
  1304 
  1289 
  1305     TPtrC suid( iReceivedObjectInfo->DesC( CMTPObjectMetaData::ESuid ) );
  1290     TPtrC suid( iReceivedObjectInfo->DesC( CMTPObjectMetaData::ESuid ) );
  1306     PRINT1( _L( "MM MTP <> CSendObject::AddMediaToStoreL suid = %S" ), &suid );
  1291     PRINT1( _L( "MM MTP <> CSendObject::AddMediaToStoreL suid = %S" ), &suid );
  1307     TParsePtrC parse( suid );
  1292     TParsePtrC parse( suid );
  1308     iDpConfig.GetWrapperL().SetStorageRootL( parse.Drive() );
  1293     iDpConfig.GetWrapperL().SetStorageRootL( parse.Drive() );
  1309     iDpConfig.GetWrapperL().AddObjectL( iFullPath, isVideo );
  1294     iDpConfig.GetWrapperL().AddObjectL( iFullPath, iObjectFormat, subFormatCode );
  1310 
  1295 
  1311     if ( isVideo )
  1296     if ( isVideo )
  1312         {
  1297         {
  1313         TInt err = KErrNone;
  1298         TInt err = KErrNone;
  1314             TRAP( err, iDpConfig.GetWrapperL().SetImageObjPropL( iFullPath, iWidth, iHeight ) );
  1299             TRAP( err, iDpConfig.GetWrapperL().SetImageObjPropL( iFullPath, iWidth, iHeight ) );
  1340     {
  1325     {
  1341     // Delete this object from file system.
  1326     // Delete this object from file system.
  1342     if ( iProgress == ESendObjectInProgress )
  1327     if ( iProgress == ESendObjectInProgress )
  1343         {
  1328         {
  1344         PRINT1( _L( "MM MTP <> CSendObject::Rollback ROLLBACK_FILE %S" ), &iFullPath );
  1329         PRINT1( _L( "MM MTP <> CSendObject::Rollback ROLLBACK_FILE %S" ), &iFullPath );
       
  1330         // Close the interrupted transfer file by delete iFileReceived object
       
  1331         delete iFileReceived;
       
  1332         iFileReceived = NULL;
       
  1333 
  1345         iFramework.Fs().Delete( iFullPath );
  1334         iFramework.Fs().Delete( iFullPath );
  1346             TRAP_IGNORE( iFramework.ObjectMgr().UnreserveObjectHandleL( *iReceivedObjectInfo ) );
  1335         TRAP_IGNORE( iFramework.ObjectMgr().UnreserveObjectHandleL( *iReceivedObjectInfo ) );
  1347         iProgress = EObjectNone;
  1336         iProgress = EObjectNone;
  1348         }
  1337         }
  1349     }
  1338     }
  1350 
  1339 
  1351 // end of file
  1340 // end of file