mmappcomponents/mmmtpdataprovider/src/mmmtpdputility.cpp
changeset 32 edd273b3192a
parent 27 cbb1bfb7ebfb
child 40 4a1905d205a2
equal deleted inserted replaced
27:cbb1bfb7ebfb 32:edd273b3192a
    25 #include <caf/content.h>
    25 #include <caf/content.h>
    26 #include <mtp/cmtpobjectmetadata.h>
    26 #include <mtp/cmtpobjectmetadata.h>
    27 #include <mtp/mmtpdataproviderframework.h>
    27 #include <mtp/mmtpdataproviderframework.h>
    28 #include <mtp/mmtpobjectmgr.h>
    28 #include <mtp/mmtpobjectmgr.h>
    29 #include <mtp/tmtptypeuint32.h>
    29 #include <mtp/tmtptypeuint32.h>
       
    30 #include <e32property.h>    // for RProperty
    30 
    31 
    31 // for asf mimetype parsing
    32 // for asf mimetype parsing
    32 #ifdef __WINDOWS_MEDIA
    33 #ifdef __WINDOWS_MEDIA
    33 #include <hxmetadatakeys.h>
    34 #include <hxmetadatakeys.h>
    34 #include <hxmetadatautil.h>
    35 #include <hxmetadatautil.h>
    37 #include "mmmtpdputility.h"
    38 #include "mmmtpdputility.h"
    38 #include "mmmtpdpfiledefs.h"
    39 #include "mmmtpdpfiledefs.h"
    39 #include "tobjectdescription.h"
    40 #include "tobjectdescription.h"
    40 #include "mmmtpdplogger.h"
    41 #include "mmmtpdplogger.h"
    41 #include "mmmtpdp_variant.hrh"
    42 #include "mmmtpdp_variant.hrh"
       
    43 #include "cmmmtpdpaccesssingleton.h"
    42 
    44 
    43 using namespace ContentAccess;
    45 using namespace ContentAccess;
    44 
    46 
    45 // local to this file, non standard mimetype used for ASF parsing with helix
    47 // local to this file, non standard mimetype used for ASF parsing with helix
    46 _LIT( KHxMimeTypeWma, "audio/x-hx-wma" );
    48 _LIT( KHxMimeTypeWma, "audio/x-hx-wma" );
    98             else if ( file.Ext().CompareF( KTxtExtensionASF ) == 0 )
   100             else if ( file.Ext().CompareF( KTxtExtensionASF ) == 0 )
    99                 format = EMTPFormatCodeASF;
   101                 format = EMTPFormatCodeASF;
   100 #endif // __WINDOWS_MEDIA
   102 #endif // __WINDOWS_MEDIA
   101             else if ( file.Ext().CompareF( KTxtExtensionODF ) == 0 )
   103             else if ( file.Ext().CompareF( KTxtExtensionODF ) == 0 )
   102                 {
   104                 {
   103                 HBufC8* mime = MmMtpDpUtility::OdfMimeTypeL( file.FullName() );
   105                 HBufC8* mime(NULL);
       
   106                 TRAP_IGNORE( mime = MmMtpDpUtility::OdfMimeTypeL( file.FullName() ) );
   104                 if ( mime != NULL )
   107                 if ( mime != NULL )
   105                     {
   108                     {
   106                     // 3GP
   109                     // 3GP
   107                     if ( mime->CompareF( KMimeTypeAudio3gpp ) == 0
   110                     if ( mime->CompareF( KMimeTypeAudio3gpp ) == 0
   108                         || mime->CompareF( KMimeTypeVideo3gpp ) == 0 )
   111                         || mime->CompareF( KMimeTypeVideo3gpp ) == 0 )
   699     PRINT1( _L( "MM MTP <= MmMtpDpUtility::GetDrmStatus, drmStatus: %d" ), drmStatus );
   702     PRINT1( _L( "MM MTP <= MmMtpDpUtility::GetDrmStatus, drmStatus: %d" ), drmStatus );
   700 
   703 
   701     return drmStatus;
   704     return drmStatus;
   702     }
   705     }
   703 
   706 
       
   707 EXPORT_C void MmMtpDpUtility::SetPSStatus( TMtpPSStatus aStatus )
       
   708     {
       
   709     TBool changeScheduled = EFalse;
       
   710     CMmMtpDpAccessSingleton::CancelActiveToIdleStatusChange();  // cancel any outstanding delay status change
       
   711     
       
   712     if ( aStatus == EMtpPSStatusReadyToSync )
       
   713         {
       
   714         TInt mtpStatus;
       
   715         RProperty::Get( KMtpPSUid, KMtpPSStatus, mtpStatus );
       
   716         
       
   717         if ( mtpStatus == EMtpPSStatusActive )
       
   718             {
       
   719             CMmMtpDpAccessSingleton::ActiveToIdleStatusChange();
       
   720             changeScheduled = ETrue;
       
   721             }
       
   722         }
       
   723 
       
   724     if ( !changeScheduled )
       
   725         DoSetPSStatus( aStatus );
       
   726     }
       
   727 
       
   728 void MmMtpDpUtility::DoSetPSStatus( TMtpPSStatus aStatus )
       
   729     {
       
   730     TInt mtpStatus;
       
   731     RProperty::Get( KMtpPSUid, KMtpPSStatus, mtpStatus );
       
   732 
       
   733     if ( mtpStatus != aStatus )
       
   734         {
       
   735         TInt err = RProperty::Set( KMtpPSUid, KMtpPSStatus, aStatus );
       
   736         PRINT3( _L("MM MTP <> CRequestProcessor::DoSetPSStatus err = %d, previous = %d, current = %d" ), err , mtpStatus, aStatus);
       
   737         }
       
   738     }
   704 // end of file
   739 // end of file