mmappcomponents/mmmtpdataprovider/inc/cmmmtpdpmetadataaccesswrapper.h
changeset 0 a2952bb97e68
child 9 bee149131e4b
child 25 d881023c13eb
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:  Meta data Access Wrapper
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CMMMTPDPMETADATAACCESSWRAPPER_H
       
    20 #define CMMMTPDPMETADATAACCESSWRAPPER_H
       
    21 
       
    22 #include <mtp/cmtpobjectmetadata.h>
       
    23 #include <mtp/mtpprotocolconstants.h>
       
    24 #include <mpxmediageneraldefs.h>
       
    25 #include <mtp/mmtpdataproviderframework.h>
       
    26 
       
    27 // forward declacration
       
    28 class CMmMtpDpMetadataMpxAccess;
       
    29 class CMmMtpDpMetadataVideoAccess;
       
    30 
       
    31 class RFs;
       
    32 class MMTPType;
       
    33 class CMTPTypeObjectPropList;
       
    34 class CMPXMediaArray;
       
    35 class CMPXMedia;
       
    36 class MMTPDataProviderFramework;
       
    37 
       
    38 class CMmMtpDpMetadataAccessWrapper : public CBase
       
    39     {
       
    40 public:
       
    41     static CMmMtpDpMetadataAccessWrapper* NewL( RFs& aRfs, 
       
    42         MMTPDataProviderFramework& aFramework );
       
    43 
       
    44     /**
       
    45     * Destructor
       
    46     */
       
    47     ~CMmMtpDpMetadataAccessWrapper();
       
    48 
       
    49 public:
       
    50     /**
       
    51     * Get all playlists from MPX database in the assigned store
       
    52     * @param aStoreRoot, specify in which drive playlists are stored
       
    53     * @param aPlaylists, return result array
       
    54     */
       
    55     IMPORT_C void GetAllPlaylistL( const TDesC& aStoreRoot,
       
    56         CMPXMediaArray** aPlaylists );
       
    57 
       
    58     /**
       
    59     * Get all references of specified playlist
       
    60     * @param aPlaylist, specify of which reference should be get
       
    61     * @param aReferences, return result array which stored handles of all references
       
    62     */
       
    63     IMPORT_C void GetAllReferenceL( CMPXMedia* aPlaylist,
       
    64         CDesCArray& aReferences );
       
    65 
       
    66     /**
       
    67     * Get an playlist name from CMPXMedia object
       
    68     * @param aPlaylist, specify the source
       
    69     * @param aPlaylistName, return result
       
    70     */
       
    71     IMPORT_C void GetPlaylistNameL( CMPXMedia* aPlaylist, TDes& aPlaylistName );
       
    72 
       
    73     /**
       
    74     * Add object (music, video and playlist) info to DB
       
    75     * @param aFullFileName, full file name of file
       
    76     * @return void
       
    77     */
       
    78     void AddObjectL( const TDesC& aFullFileName, TBool aIsVideo = EFalse );
       
    79 
       
    80     /**
       
    81     * Set playlist to DB
       
    82     * @param aPlaylistFileName, full file name of playlist file
       
    83     * @param aRefFileArray, a array to store the full file name of media files
       
    84     * @return void
       
    85     */
       
    86     IMPORT_C void SetPlaylistL( const TDesC& aPlaylistFileName,
       
    87         CDesCArray& aRefFileArray );
       
    88 
       
    89     /**
       
    90     * Gets a piece of metadata from the collection
       
    91     * @param aPropCode, specify property code of aMediaProp
       
    92     * @param aNewData, object property value which will be get from
       
    93     *    aObjectMetaData
       
    94     * @param aObjectMetaData, owner of the property which should be
       
    95     *    inserted or updated into database
       
    96     * @return void
       
    97     */
       
    98     IMPORT_C void GetObjectMetadataValueL( const TUint16 aPropCode,
       
    99         MMTPType& aNewData,
       
   100         const CMTPObjectMetaData& aObjectMetaData );
       
   101 
       
   102     /**
       
   103     * Sets a piece of metadata in the collection
       
   104     * @param aPropCode, specify property code of aMediaProp
       
   105     * @param aNewData, object property value which will be set into
       
   106     *     aObjectMetaData
       
   107     * @param aObjectMetaData, owner of the property which should be
       
   108     *     inserted or updated into database
       
   109     * @return void
       
   110     */
       
   111     void SetObjectMetadataValueL( const TUint16 aPropCode,
       
   112         const MMTPType& aNewData,
       
   113         const CMTPObjectMetaData& aObjectMetaData );
       
   114 
       
   115     /**
       
   116     * Renames the file part of a record in the collection database
       
   117     * @param aFile, old full file name of Media file
       
   118     * @param aNewFileName, new file name need update
       
   119     * @return void
       
   120     */
       
   121     IMPORT_C void RenameObjectL( const TDesC& aOldFileName, const TDesC& aNewFileName );
       
   122 
       
   123     /**
       
   124     * Deletes metadata information associated with the object
       
   125     * @param aFullFileName, full file name of Media file
       
   126     * @param aFormatCode, format code
       
   127     */
       
   128     void DeleteObjectL( const TDesC& aFullFileName, const TUint aFormatCode );
       
   129 
       
   130     /**
       
   131     * Set current  drive info
       
   132     * @param aStorageRoot, current drive info
       
   133     */
       
   134     void SetStorageRootL( const TDesC& aStorageRoot );
       
   135 
       
   136     /*
       
   137     * set image specific properties specific to videos
       
   138     * @param aFullFileName, the fullFileName of object
       
   139     * @param aWidth,  the width of an object in pixels to set
       
   140     * @parem aHeight,  the height of an object in pixels to set
       
   141     */
       
   142     void SetImageObjPropL( const TDesC& aFullFileName,
       
   143            const TUint32 aWidth,
       
   144            const TUint32 aHeight );
       
   145 
       
   146     /*
       
   147     * get image specific properties specific to videos
       
   148     * @param aFullFileName, the fullFileName of object
       
   149     * @param aWidth,  the width of an object in pixels to get
       
   150     * @parem aHeight,  the height of an object in pixels to get
       
   151     */
       
   152     void GetImageObjPropL( const TDesC& aFullFileName,
       
   153             TUint32& aWidth,
       
   154             TUint32& aHeight );
       
   155     
       
   156     /**
       
   157     * Get Modified object from DB
       
   158     * @param aStorageRoot, the root path of storage
       
   159     * @param arrayCount, array count
       
   160     * @param aRefFileArray, a array to store the full file name of media files
       
   161     * @return void
       
   162     */
       
   163     IMPORT_C void GetModifiedContentL( const TDesC& aStorageRoot, 
       
   164         TInt& arrayCount,
       
   165         CDesCArray& aRefFileArray );
       
   166  
       
   167     /**
       
   168     * Updated Music DB
       
   169     * @return void
       
   170     */
       
   171     IMPORT_C void UpdateMusicCollectionL(); 
       
   172     
       
   173     /*
       
   174     * Called when the MTP session is initialised
       
   175     */
       
   176     void OpenSessionL();
       
   177 
       
   178     /*
       
   179     * clean up db resource especially for video dp
       
   180     */
       
   181     void CloseSessionL();
       
   182     
       
   183     /**
       
   184     * Cleanup database
       
   185     */
       
   186     IMPORT_C void CleanupDatabaseL();
       
   187     
       
   188     /**
       
   189     * if the playlsit exist in the MPX DB
       
   190     * @param aSuid, the suid of playlsit
       
   191     */
       
   192     TBool IsExistL( const TDesC& aSuid );
       
   193     
       
   194     // related to dummy files
       
   195     /**
       
   196     * Add one dummy file to dummy files array
       
   197     */
       
   198     IMPORT_C void AddDummyFileL( const TDesC& aDummyFileName );
       
   199     
       
   200     /**
       
   201     * Delete one dummy file from dummy files array
       
   202     */    
       
   203     IMPORT_C void DeleteDummyFile( const TDesC& aDummyFileName );
       
   204     
       
   205     /**
       
   206     * Create a Dummy File from the virtual playlist URI
       
   207     * @param aPlaylistName, specify the filename of the dummy file
       
   208     */
       
   209     IMPORT_C void CreateDummyFile( const TDesC& aPlaylistName );
       
   210     
       
   211 private:
       
   212 
       
   213     CMmMtpDpMetadataAccessWrapper( RFs& aRfs, MMTPDataProviderFramework& aFramework );
       
   214 
       
   215     void ConstructL();
       
   216 
       
   217     TMPXGeneralCategory Category( const TUint aFormatCode );
       
   218     
       
   219     /**
       
   220     * Remove all dummy file of which format is "pla", and leave the "m3u"
       
   221     */
       
   222     void RemoveDummyFiles();
       
   223 
       
   224 private:
       
   225     // Data
       
   226     RFs& iRfs;
       
   227     CMmMtpDpMetadataMpxAccess* iMmMtpDpMetadataMpxAccess;
       
   228     CMmMtpDpMetadataVideoAccess* iMmMtpDpMetadataVideoAccess;
       
   229     TBool iOpenSession;
       
   230     
       
   231     MMTPDataProviderFramework& iFramework;  
       
   232     
       
   233     CDesCArray* iPlaylistArray;
       
   234     
       
   235     };
       
   236 
       
   237 #endif // CMMMTPDPMETADATAACCESSWRAPPER_H