mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/abstractmediamtpdataprovider/src/cabstractmediamtpdataprovider.cpp
branchRCL_3
changeset 17 780c925249c1
parent 15 d240f0a77280
child 19 51035f0751c2
equal deleted inserted replaced
15:d240f0a77280 17:780c925249c1
    74     iAbstractMediaEnumerator( NULL ),
    74     iAbstractMediaEnumerator( NULL ),
    75     iPendingEnumerations ( KAbstractMediaMtpDpArrayGranularity ),
    75     iPendingEnumerations ( KAbstractMediaMtpDpArrayGranularity ),
    76     iActiveProcessor( -1 ),
    76     iActiveProcessor( -1 ),
    77     iRenameObject( NULL ),
    77     iRenameObject( NULL ),
    78     iSupportedFormat( KAbstractMediaMtpDpArrayGranularity ),
    78     iSupportedFormat( KAbstractMediaMtpDpArrayGranularity ),
    79     iSupportedProperties( KAbstractMediaMtpDpArrayGranularity )
    79 #ifdef MMMTPDP_ABSTRACTAUDIOALBUM_SUPPORT
       
    80     iSupportedPropAbstractAlbum( KAbstractMediaMtpDpArrayGranularity ),
       
    81 #endif
       
    82     iSupportedPropPlaylist( KAbstractMediaMtpDpArrayGranularity ),
       
    83     iSupportedPropAll( KAbstractMediaMtpDpArrayGranularity )
    80     {
    84     {
    81     // Do nothing
    85     // Do nothing
    82     }
    86     }
    83 
    87 
    84 // -----------------------------------------------------------------------------
    88 // -----------------------------------------------------------------------------
   106 
   110 
   107     if ( iRenameObject )
   111     if ( iRenameObject )
   108         delete iRenameObject;
   112         delete iRenameObject;
   109 
   113 
   110     iSupportedFormat.Close();
   114     iSupportedFormat.Close();
   111     iSupportedProperties.Close();
   115 #ifdef MMMTPDP_ABSTRACTAUDIOALBUM_SUPPORT
       
   116     iSupportedPropAbstractAlbum.Close();
       
   117 #endif
       
   118     iSupportedPropPlaylist.Close();
       
   119     iSupportedPropAll.Close();
   112 
   120 
   113     PRINT( _L( "MM MTP => CAbstractMediaMtpDataProvider::~CAbstractMediaMtpDataProvider" ) );
   121     PRINT( _L( "MM MTP => CAbstractMediaMtpDataProvider::~CAbstractMediaMtpDataProvider" ) );
   114     }
   122     }
   115 
   123 
   116 void CAbstractMediaMtpDataProvider::Cancel()
   124 void CAbstractMediaMtpDataProvider::Cancel()
   127     {
   135     {
   128     PRINT( _L( "MM MTP => CAbstractMediaMtpDataProvider::ConstructL" ) );
   136     PRINT( _L( "MM MTP => CAbstractMediaMtpDataProvider::ConstructL" ) );
   129 
   137 
   130     iAbstractMediaEnumerator = CAbstractMediaMtpDataProviderEnumerator::NewL( Framework(), *this );
   138     iAbstractMediaEnumerator = CAbstractMediaMtpDataProviderEnumerator::NewL( Framework(), *this );
   131 
   139 
   132     CMmMtpDpAccessSingleton::CreateL( Framework().Fs(), Framework() );
   140     CMmMtpDpAccessSingleton::CreateL( Framework() );
   133 
   141 
   134     GetSupportedFormatL();
   142     GetSupportedFormatL();
   135     GetSupportedPropertiesL();
   143     GetSupportedPropertiesL();
       
   144     GetAllSupportedPropL();
   136 
   145 
   137     iPropSettingUtility = CAbstractMediaMtpDataProviderPropertySettingUtility::NewL();
   146     iPropSettingUtility = CAbstractMediaMtpDataProviderPropertySettingUtility::NewL();
   138     iDescriptionUtility = CAbstractMediaMtpDataProviderDescriptionUtility::NewL();
   147     iDescriptionUtility = CAbstractMediaMtpDataProviderDescriptionUtility::NewL();
   139 
   148 
   140     PRINT( _L( "MM MTP <= CAbstractMediaMtpDataProvider::ConstructL" ) );
   149     PRINT( _L( "MM MTP <= CAbstractMediaMtpDataProvider::ConstructL" ) );
   358             }
   367             }
   359             break;
   368             break;
   360 
   369 
   361         case EObjectProperties:
   370         case EObjectProperties:
   362             {
   371             {
   363             TInt count = iSupportedProperties.Count();
   372             TInt count = iSupportedPropAll.Count();
   364 
   373 
   365             for ( TInt i = 0; i < count; i++ )
   374             for ( TInt i = 0; i < count; i++ )
   366                 {
   375                 {
   367                 aArray.Append( iSupportedProperties[i] );
   376                 aArray.Append( iSupportedPropAll[i] );
   368                 }
   377                 }
   369             PRINT1( _L( "MM MTP <> CAbstractMediaMtpDataProvider::Supported properties count = %d" ), aArray.Count() );
   378             PRINT1( _L( "MM MTP <> CAbstractMediaMtpDataProvider::Supported properties count = %d" ), aArray.Count() );
   370             }
   379             }
   371             break;
   380             break;
   372 
   381 
   390 void CAbstractMediaMtpDataProvider::SupportedL( TMTPSupportCategory aCategory,
   399 void CAbstractMediaMtpDataProvider::SupportedL( TMTPSupportCategory aCategory,
   391     CDesCArray& aStrings ) const
   400     CDesCArray& aStrings ) const
   392     {
   401     {
   393     if( aCategory == EFormatExtensionSets )
   402     if( aCategory == EFormatExtensionSets )
   394         {
   403         {
   395         //EMTPFormatCodeM3U,
   404 #ifdef MMMTPDP_ABSTRACTAUDIOALBUM_SUPPORT
       
   405         aStrings.AppendL(KFormatExtensionALB);
       
   406 #endif
   396         aStrings.AppendL(KFormatExtensionM3U);
   407         aStrings.AppendL(KFormatExtensionM3U);
   397         aStrings.AppendL(KFormatExtensionPLA);
   408         aStrings.AppendL(KFormatExtensionPLA);
   398         aStrings.AppendL(KFormatExtensionVIR);
   409         aStrings.AppendL(KFormatExtensionVIR);
   399         }
   410         }
   400     }
   411     }
   525         {
   536         {
   526         InsertL( iSupportedFormat, KAbstractMediaMtpDataProviderSupportedFormats[i] );
   537         InsertL( iSupportedFormat, KAbstractMediaMtpDataProviderSupportedFormats[i] );
   527         }
   538         }
   528     }
   539     }
   529 
   540 
   530 const RArray<TUint>* CAbstractMediaMtpDataProvider::GetSupportedPropertiesL( TUint32 /*aFormatCode*/ ) const
   541 const RArray<TUint>* CAbstractMediaMtpDataProvider::GetSupportedPropertiesL( TUint32 aFormatCode ) const
   531     {
   542     {
   532     // May need add more implementation here for further extension.
   543     if ( ( aFormatCode == EMTPFormatCodeM3UPlaylist ) || ( aFormatCode == EMTPFormatCodeAbstractAudioVideoPlaylist ) )
   533     return &iSupportedProperties;
   544         {
       
   545         return &iSupportedPropPlaylist;
       
   546         }
       
   547 #ifdef MMMTPDP_ABSTRACTAUDIOALBUM_SUPPORT
       
   548     else if ( aFormatCode == EMTPFormatCodeAbstractAudioAlbum )
       
   549         {
       
   550         return &iSupportedPropAbstractAlbum;
       
   551         }
       
   552 #endif
       
   553     else
       
   554         {
       
   555         User::Leave( KErrNotSupported );
       
   556         }
       
   557     // should never run to this line, just for avoiding warning.
       
   558     return NULL;
   534     }
   559     }
   535 
   560 
   536 // ---------------------------------------------------------------------------
   561 // ---------------------------------------------------------------------------
   537 // CAbstractMediaMtpDataProvider::GetSupportedPropertiesL
   562 // CAbstractMediaMtpDataProvider::GetSupportedPropertiesL
   538 //
   563 //
   539 // ---------------------------------------------------------------------------
   564 // ---------------------------------------------------------------------------
   540 //
   565 //
   541 void CAbstractMediaMtpDataProvider::GetSupportedPropertiesL()
   566 void CAbstractMediaMtpDataProvider::GetSupportedPropertiesL()
   542     {
   567     {
   543     iSupportedProperties.Reset();
   568 #ifdef MMMTPDP_ABSTRACTAUDIOALBUM_SUPPORT
       
   569     iSupportedPropAbstractAlbum.Reset();
       
   570 #endif
       
   571     iSupportedPropPlaylist.Reset();
   544 
   572 
   545     TInt count = 0, i = 0;
   573     TInt count = 0, i = 0;
   546     count = sizeof( KMmMtpDpSupportedPropMandatoryAll ) / sizeof( TUint16 );
   574     count = sizeof( KMmMtpDpSupportedPropMandatoryAll ) / sizeof( TUint16 );
   547     for ( i = 0; i < count; i++ )
   575     for ( i = 0; i < count; i++ )
   548         {
   576         {
   549         InsertL( iSupportedProperties, KMmMtpDpSupportedPropMandatoryAll[i] );
   577 #ifdef MMMTPDP_ABSTRACTAUDIOALBUM_SUPPORT
       
   578         InsertL( iSupportedPropAbstractAlbum, KMmMtpDpSupportedPropMandatoryAll[i] );
       
   579 #endif
       
   580         InsertL( iSupportedPropPlaylist, KMmMtpDpSupportedPropMandatoryAll[i] );
   550         }
   581         }
   551 
   582 
   552     count = sizeof( KMmMtpDpSupportedPropAdditionalAll ) / sizeof( TUint16 );
   583     count = sizeof( KMmMtpDpSupportedPropAdditionalAll ) / sizeof( TUint16 );
   553     for ( i = 0; i < count; i++ )
   584     for ( i = 0; i < count; i++ )
   554         {
   585         {
   555         InsertL( iSupportedProperties, KMmMtpDpSupportedPropAdditionalAll[i] );
   586 #ifdef MMMTPDP_ABSTRACTAUDIOALBUM_SUPPORT            
   556         }
   587         InsertL( iSupportedPropAbstractAlbum, KMmMtpDpSupportedPropAdditionalAll[i] );
       
   588 #endif
       
   589         InsertL( iSupportedPropPlaylist, KMmMtpDpSupportedPropAdditionalAll[i] );
       
   590         }
       
   591 
       
   592 #ifdef MMMTPDP_ABSTRACTAUDIOALBUM_SUPPORT
       
   593     count = sizeof( KMmMtpDpSupportedPropMandatoryALB ) / sizeof( TUint16 );
       
   594     for ( i = 0; i < count; i++ )
       
   595         {
       
   596         InsertL( iSupportedPropAbstractAlbum, KMmMtpDpSupportedPropMandatoryALB[i] );
       
   597         }
       
   598 #endif        
   557     }
   599     }
   558 
   600 
   559 // ---------------------------------------------------------------------------
   601 // ---------------------------------------------------------------------------
   560 // CAbstractMediaMtpDataProvider::GetAllSupportedProperties
   602 // CAbstractMediaMtpDataProvider::GetAllSupportedProperties
   561 //
   603 //
   562 // ---------------------------------------------------------------------------
   604 // ---------------------------------------------------------------------------
   563 //
   605 //
   564 const RArray<TUint>* CAbstractMediaMtpDataProvider::GetAllSupportedProperties() const
   606 const RArray<TUint>* CAbstractMediaMtpDataProvider::GetAllSupportedProperties() const
   565     {
   607     {
   566     return &iSupportedProperties;
   608     return &iSupportedPropAll;
       
   609     }
       
   610 
       
   611 void CAbstractMediaMtpDataProvider::GetAllSupportedPropL()
       
   612     {
       
   613     iSupportedPropAll.Reset();
       
   614 
       
   615     TInt count = 0, i = 0;
       
   616     count = sizeof( KMmMtpDpSupportedPropMandatoryAll ) / sizeof( TUint16 );
       
   617     for ( i = 0; i < count; i++ )
       
   618         {
       
   619         InsertL( iSupportedPropAll, KMmMtpDpSupportedPropMandatoryAll[i] );
       
   620         }
       
   621 
       
   622     count = sizeof( KMmMtpDpSupportedPropAdditionalAll ) / sizeof( TUint16 );
       
   623     for ( i = 0; i < count; i++ )
       
   624         {
       
   625         InsertL( iSupportedPropAll, KMmMtpDpSupportedPropAdditionalAll[i] );
       
   626         }
       
   627 
       
   628     count = sizeof( KMmMtpDpSupportedPropMandatoryALB ) / sizeof( TUint16 );
       
   629     for ( i = 0; i < count; i++ )
       
   630         {
       
   631         InsertL( iSupportedPropAll, KMmMtpDpSupportedPropMandatoryALB[i] );
       
   632         }
   567     }
   633     }
   568 
   634 
   569 // ---------------------------------------------------------------------------
   635 // ---------------------------------------------------------------------------
   570 // CMediaMtpDataProvider::GetDefaultStorageIdL
   636 // CMediaMtpDataProvider::GetDefaultStorageIdL
   571 //
   637 //