mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/abstractmediamtpdataprovider/inc/cabstractmediamtpdataproviderenumerator.h
changeset 0 a2952bb97e68
child 8 bee149131e4b
equal deleted inserted replaced
-1:000000000000 0:a2952bb97e68
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Enumerator objects
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CABSTRACTMEDIAMTPDATAPROVIDERENUMERATOR_H
       
    20 #define CABSTRACTMEDIAMTPDATAPROVIDERENUMERATOR_H
       
    21 
       
    22 #include <e32base.h>
       
    23 #include <d32dbms.h>
       
    24 
       
    25 #include "mmmtpenumerationcallback.h"
       
    26 #include "cmmmtpdpperflog.h"
       
    27 
       
    28 // keep here to avoid warning on urel
       
    29 _LIT( KMpxGetAllPlaylist, "MpxGetAllPlaylist" );
       
    30 _LIT( KMpxGetPlaylistName, "MpxGetPlaylistName" );
       
    31 _LIT( KMpxQueryPlaylistReference, "MpxQueryPlaylistReference" );
       
    32 _LIT( KObjectManagerObjectUid, "ObjectManagerObjectUid" );
       
    33 _LIT( KObjectManagerInsert, "ObjectManagerInsert" );
       
    34 _LIT( KObjectManagerHandle, "ObjectManagerHandle" );
       
    35 _LIT( KReferenceManagerSetReference, "ReferenceManagerSetReference" );
       
    36 
       
    37 // Forward declarations
       
    38 class MMTPDataProviderFramework;
       
    39 class MMTPObjectMgr;
       
    40 class CAbstractMediaMtpDataProvider;
       
    41 class CMTPObjectMetaData;
       
    42 class CMmMtpDpMetadataAccessWrapper;
       
    43 class CMPXMediaArray;
       
    44 
       
    45 /**
       
    46 * Defines file enumerator.  Enumerates all files/directories under a
       
    47 * specified path or storage
       
    48 */
       
    49 class CAbstractMediaMtpDataProviderEnumerator: public CActive
       
    50     {
       
    51 public:
       
    52     /**
       
    53     * Two phase constructor
       
    54     * @param aFramework Reference to MMTPDataProviderFramework
       
    55     * @param aDataProvider Reference to Abstract Media DataProvider
       
    56     * @return A pointer to a new instance of the object
       
    57     */
       
    58     static CAbstractMediaMtpDataProviderEnumerator* NewL( MMTPDataProviderFramework& aFramework,
       
    59         CAbstractMediaMtpDataProvider& aDataProvider );
       
    60 
       
    61     /**
       
    62     * destructor
       
    63     */
       
    64     ~CAbstractMediaMtpDataProviderEnumerator();
       
    65 
       
    66     /**
       
    67     * Kick off the enumeration on the specified storage
       
    68     * @param aStorageId storage to be enumerated
       
    69     */
       
    70     void StartL( TUint32 aStorageId );
       
    71 
       
    72 protected: // from CActive
       
    73     /**
       
    74     * Cancel the enumeration process
       
    75     */
       
    76     void DoCancel();
       
    77 
       
    78     void RunL();
       
    79 
       
    80     /**
       
    81     * Ignore the error, continue with the next one
       
    82     */
       
    83     TInt RunError( TInt aError );
       
    84 
       
    85 private:
       
    86     /**
       
    87     * Standard C++ Constructor
       
    88     * @param aFramework Reference to MMTPDataProviderFramework
       
    89     * @param aDataProvider Reference to Abstract Media DataProvider
       
    90     */
       
    91     CAbstractMediaMtpDataProviderEnumerator( MMTPDataProviderFramework& aFramework,
       
    92         CAbstractMediaMtpDataProvider& aDataProvider );
       
    93 
       
    94     void ConstructL();
       
    95 
       
    96     /**
       
    97     * Called when the enumeration is completed
       
    98     */
       
    99     void SignalCompleteL( MMTPEnumerationCallback& aCallback,
       
   100         TInt aError = KErrNone );
       
   101 
       
   102     void ScanStorageL( TUint32 aStorageId );
       
   103 
       
   104     /**
       
   105     * Scan next storage
       
   106     */
       
   107     void ScanNextL();
       
   108 
       
   109     /**
       
   110     * Add a file entry to the object store
       
   111     * @param aPath current scanned file path
       
   112     */
       
   113     void AddEntryL( const TDesC& aSuid );
       
   114 
       
   115     /**
       
   116     * Add references of specified abstract media into reference db
       
   117     * @param aAbstractMediaName, specify the abstract media of which references should be added into db
       
   118     * @param aReferences, suid array which stored references
       
   119     */
       
   120     void AddReferencesL( const TDesC& aAbstractMediaName, CDesCArray& aReferences );
       
   121 
       
   122 private:
       
   123     // Owned
       
   124     /** MMTPDataProviderFramework used to access MTP components*/
       
   125     MMTPDataProviderFramework& iFramework;
       
   126 
       
   127     /** MTP Object Manager */
       
   128     MMTPObjectMgr& iObjectMgr;
       
   129 
       
   130     /** MTP Data Provider ID */
       
   131     TUint iDataProviderId;
       
   132 
       
   133     /** Provides Callback mechanism for completion of enumeration*/
       
   134     CAbstractMediaMtpDataProvider& iDataProvider;
       
   135 
       
   136     TParse iPath;
       
   137     TEntryArray iEntries;
       
   138     TInt iFirstUnprocessed;
       
   139     RArray<TUint> iStorages;
       
   140     TUint32 iStorageId;
       
   141     TUint32 iParentHandle;
       
   142 
       
   143     CMPXMediaArray* iAbstractMedias;
       
   144     TInt iCount;
       
   145     TInt iCurrentIndex;
       
   146 
       
   147 #if defined(_DEBUG) || defined(MMMTPDP_PERFLOG)
       
   148     CMmMtpDpPerfLog* iPerfLog;
       
   149 #endif
       
   150 
       
   151     };
       
   152 
       
   153 #endif // CABSTRACTMEDIAMTPDATAPROVIDERENUMERATOR_H