mmappcomponents/mmmtpdataprovider/inc/cmmmtpdpmetadatampxaccess.h
branchRCL_3
changeset 9 bee149131e4b
parent 0 a2952bb97e68
child 14 05b0d2323768
equal deleted inserted replaced
4:d45095c2f4f3 9:bee149131e4b
     1 /*
     1 /*
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
     2  * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3  * All rights reserved.
     4 * This component and the accompanying materials are made available
     4  * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5  * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6  * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     8 *
     8  *
     9 * Initial Contributors:
     9  * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    10  * Nokia Corporation - initial contribution.
    11 *
    11  *
    12 * Contributors:
    12  * Contributors:
    13 *
    13  *
    14 * Description:  Meta data Mpx access
    14  * Description:  Meta data Mpx access
    15 *
    15  *
    16 */
    16  */
    17 
       
    18 
    17 
    19 #ifndef CMMMTPDPMETADATAMPXACCESS_H
    18 #ifndef CMMMTPDPMETADATAMPXACCESS_H
    20 #define CMMMTPDPMETADATAMPXACCESS_H
    19 #define CMMMTPDPMETADATAMPXACCESS_H
    21 
    20 
    22 #include <badesca.h>
    21 #include <badesca.h>
    23 
    22 
    24 #include "cmmmtpdpperflog.h"
    23 #include "cmmmtpdpperflog.h"
    25 
       
    26 // keep here to avoid warning on urel
       
    27 _LIT( KMpxCollectionNewL, "MpxCollectionNewL" );
       
    28 _LIT( KMpxCollectionAddL, "MpxCollectionAddL" );
       
    29 _LIT( KMpxCollectionGetL, "MpxCollectionGetL" );
       
    30 _LIT( KMpxCollectionSetL, "MpxCollectionSetL" );
       
    31 _LIT( KMpxCollectionGetPlaylist, "MpxCollectionGetPlaylist" );
       
    32 _LIT( KMpxCollectionGetReference, "MpxCollectionGetReference" );
       
    33 _LIT( KMpxCollectionFindAllLValidate, "MpxCollectionValidate" );
       
    34 _LIT( KMpxCollectionFindAllLBeforeAdd, "KMpxCollectionFindAllLBeforeAdd" );
       
    35 
    24 
    36 // forward declacration
    25 // forward declacration
    37 class CMPXMedia;
    26 class CMPXMedia;
    38 class CMTPObjectMetaData;
    27 class CMTPObjectMetaData;
    39 class MMPXCollectionHelper;
    28 class MMPXCollectionHelper;
    48     TMTPObjectPropertyCode iPropCode;
    37     TMTPObjectPropertyCode iPropCode;
    49     TMPXAttributeData iMpxAttrib;
    38     TMPXAttributeData iMpxAttrib;
    50     } TMetadataTable;
    39     } TMetadataTable;
    51 
    40 
    52 /**
    41 /**
    53 * Controls access to the music MPX store database.  Allows access to the
    42  * Controls access to the music MPX store database.  Allows access to the
    54 * information about any of the music stored in any of the MPX db's on any
    43  * information about any of the music stored in any of the MPX db's on any
    55 * of the drives. Also supports deletions and insertions into the db.
    44  * of the drives. Also supports deletions and insertions into the db.
    56 */
    45  */
    57 class CMmMtpDpMetadataMpxAccess : public CBase
    46 class CMmMtpDpMetadataMpxAccess : public CBase
    58     {
    47     {
    59 public:
    48 public:
    60 
    49 
    61     static CMmMtpDpMetadataMpxAccess* NewL( RFs& aRfs, MMTPDataProviderFramework& aFramework );
    50     static CMmMtpDpMetadataMpxAccess* NewL( RFs& aRfs,
    62 
    51         MMTPDataProviderFramework& aFramework );
    63     /**
    52 
    64     * Destructor
    53     /**
    65     */
    54      * Destructor
       
    55      */
    66     ~CMmMtpDpMetadataMpxAccess();
    56     ~CMmMtpDpMetadataMpxAccess();
    67 
    57 
    68 public:
    58 public:
    69     /**
    59     /**
    70     * Get all playlists from MPX database in the assigned store
    60      * Get all abstract medias from MPX database in the assigned store
    71     * @param aStoreRoot, specify in which drive playlists are stored
    61      * @param aStoreRoot, specify in which drive abstract medias are stored
    72     * @param aPlaylists, return result array
    62      * @param aAbstractMedias, return result array
    73     */
    63      * @param aCategory, indicate the category of abstract medias
    74     void GetAllPlaylistL( const TDesC& aStoreRoot, CMPXMediaArray** aPlaylists );
    64      */
    75 
    65     void GetAllAbstractMediaL( const TDesC& aStoreRoot,
    76     /**
    66         CMPXMediaArray** aAbstractMedias,
    77     * Get all references of specified playlist
    67         TMPXGeneralCategory aCategory );
    78     * @param aPlaylist, specify of which reference should be get
    68 
    79     * @param aReferences, return result array which stored handles of all references
    69     /**
    80     */
    70      * Get all references of specified abstract media
    81     void GetAllReferenceL( CMPXMedia* aPlaylist, CDesCArray& aReferences );
    71      * @param aAbstractMedia, specify of which reference should be get
    82 
    72      * @param aReferences, return result array which stored handles of all references
    83     /**
    73      */
    84     * Get an playlist name from CMPXMedia object
    74     void GetAllReferenceL( CMPXMedia* aAbstractMedia,
    85     * @param aPlaylist, specify the source
    75         CDesCArray& aReferences );
    86     * @param aPlaylistName, return result
    76 
    87     */
    77     /**
    88     void GetPlaylistNameL( CMPXMedia* aPlaylist, TDes& aPlaylistName );
    78      * Get an abstract media name from CMPXMedia object
    89 
    79      * @param aAbstractMedia, specify the source
    90     /**
    80      * @param aCategory, specify the category
    91     * Adds Songs info to Mpx DB
    81      * @return, name of the source, ownership transferred
    92     * @param aFullFileName, full file name of Media file
    82      */
    93     */
    83     HBufC* CMmMtpDpMetadataMpxAccess::GetAbstractMediaNameL( CMPXMedia* aAbstractMedia,
       
    84         TMPXGeneralCategory aCategory );
       
    85 
       
    86     /**
       
    87      * Adds Songs info to Mpx DB
       
    88      * @param aFullFileName, full file name of Media file
       
    89      */
    94     void AddSongL( const TDesC& aFullFileName );
    90     void AddSongL( const TDesC& aFullFileName );
    95 
    91 
    96     /**
    92     /**
    97     * Adds Playlist to Mpx DB
    93      * Adds abstract media to Mpx DB
    98     * @param aFullFileName, full file name of Playlist file
    94      * @param aFullFileName, full file name of abstract media file
    99     */
    95      * @param aCategory, indicate the category of abstract media
   100     void AddPlaylistL( const TDesC& aFullFileName );
    96      */
   101 
    97     void AddAbstractMediaL( const TDesC& aFullFileName,
   102     /**
    98         TMPXGeneralCategory aCategory );
   103     * Set playlist to DB
    99 
   104     * @param aPlaylistFileName, full file name of playlist file
   100     /**
   105     * @param aRefFileArray, a array to store the full file name of media files
   101      * Set abstract media to DB
   106     */
   102      * @param aAbstractMediaFileName, full file name of abstract media file
   107     void SetPlaylistL( const TDesC& aPlaylistFileName,
   103      * @param aRefFileArray, a array to store the full file name of media files
   108             CDesCArray& aRefFileArray );
   104      * @param aCategory, indicate the category of abstract media
       
   105      */
       
   106     void SetAbstractMediaL( const TDesC& aAbstractMediaFileName,
       
   107         CDesCArray& aRefFileArray,
       
   108         TMPXGeneralCategory aCategory );
   109 
   109 
   110     void GetObjectMetadataValueL( const TUint16 aPropCode,
   110     void GetObjectMetadataValueL( const TUint16 aPropCode,
   111             MMTPType& aNewData,
   111         MMTPType& aNewData,
   112             const CMTPObjectMetaData& aObjectMetaData );
   112         const CMTPObjectMetaData& aObjectMetaData );
   113 
   113 
   114     /**
   114     /**
   115     * Set object property and updated object in DB according property code,
   115      * Set object property and updated object in DB according property code,
   116     * only for update, not for creation
   116      * only for update, not for creation
   117     * @param aPropCode, property code of aObjectMetaData
   117      * @param aPropCode, property code of aObjectMetaData
   118     * @param aNewData, object property value which will be set into
   118      * @param aNewData, object property value which will be set into
   119     *     aObjectMetaData
   119      *     aObjectMetaData
   120     * @param aObjectMetaData, owner of the property which should be
   120      * @param aObjectMetaData, owner of the property which should be
   121     *     updated into database
   121      *     updated into database
   122     */
   122      */
   123     void SetObjectMetadataValueL( const TUint16 aPropCode,
   123     void SetObjectMetadataValueL( const TUint16 aPropCode,
   124             const MMTPType& aNewData,
   124         const MMTPType& aNewData,
   125             const CMTPObjectMetaData& aObjectMetaData );
   125         const CMTPObjectMetaData& aObjectMetaData );
   126 
   126 
   127     /**
   127     /**
   128     * Set object property and updated object in DB according property code,
   128      * Set object property and updated object in DB according property code,
   129     * only for update, not for creation
   129      * only for update, not for creation
   130     * @param aPropCode, property code of aObjectMetaData
   130      * @param aPropCode, property code of aObjectMetaData
   131     * @param aNewData, object property value which will be set into
   131      * @param aNewData, object property value which will be set into
   132     *     aObjectMetaData
   132      *     aObjectMetaData
   133     * @param aSuid, full file name of object of which properties need to set
   133      * @param aSuid, full file name of object of which properties need to set
   134     */
   134      */
   135     void SetObjectMetadataValueL( const TUint16 aPropCode,
   135     void SetObjectMetadataValueL( const TUint16 aPropCode,
   136             const MMTPType& aNewData,
   136         const MMTPType& aNewData,
   137             const TDesC& aSuid );
   137         const TDesC& aSuid );
   138 
   138 
   139     CMPXMedia* FindWMPMediaLC( TMPXAttributeData aWMPMediaID, TBool aFlag );
   139     CMPXMedia* FindWMPMediaLC( TMPXAttributeData aWMPMediaID,
   140 
   140         TBool aFlag );
   141     /**
   141 
   142     * Update the Sync flag for those not synchronized, Update the Modified
   142     /**
   143     * flag for those have been modified, and delete the stale records for
   143      * Update the Sync flag for those not synchronized, Update the Modified
   144     * files that have been deleted.
   144      * flag for those have been modified, and delete the stale records for
   145     */
   145      * files that have been deleted.
       
   146      */
   146     void UpdateMusicCollectionL();
   147     void UpdateMusicCollectionL();
   147 
   148 
   148     /**
   149     /**
   149     * Remove the file from MPX DB
   150      * Remove the file from MPX DB
   150     * @param aFullFileName, the file to remove
   151      * @param aFullFileName, the file to remove
   151     * @param aCategory, the category of the file
   152      * @param aCategory, the category of the file
   152     */
   153      */
   153     void DeleteObjectL( const TDesC& aFullFileName, TMPXGeneralCategory aCategory );
   154     void DeleteObjectL( const TDesC& aFullFileName,
   154 
   155         TMPXGeneralCategory aCategory );
   155     /**
   156 
   156     * Rename the filename onto MPX DB
   157     /**
   157     * @param aOldFileName, the old file to rename
   158      * Rename the filename onto MPX DB
   158     * @param aNewFileName, the new file name
   159      * @param aOldFileName, the old file to rename
   159     * @param aFormatCode, the format of object
   160      * @param aNewFileName, the new file name
   160     */
   161      * @param aFormatCode, the format of object
   161     void RenameObjectL( const TDesC& aOldFileName, const TDesC& aNewFileName,
   162      */
   162             TUint aFormatCode );
   163     void RenameObjectL( const TDesC& aOldFileName,
   163 
   164         const TDesC& aNewFileName,
   164     /**
   165         TUint aFormatCode );
   165     * Set current  drive info
   166 
   166     * @param aStorageRoot, current drive info
   167     /**
   167     */
   168      * Set current  drive info
       
   169      * @param aStorageRoot, current drive info
       
   170      */
   168     void SetStorageRootL( const TDesC& aStorageRoot );
   171     void SetStorageRootL( const TDesC& aStorageRoot );
   169 
   172 
   170     /**
   173     /**
   171     * Get modified content
   174      * Get modified content
   172     * @param arrayCount, count of modified content
   175      * @param arrayCount, count of modified content
   173     * @param aModifiedcontent, modified files name list
   176      * @param aModifiedcontent, modified files name list
   174     */
   177      */
   175     void GetModifiedContentL( TInt& arrayCount, CDesCArray& aModifiedcontent );
   178     void GetModifiedContentL( TInt& arrayCount,
   176     
   179         CDesCArray& aModifiedcontent );
   177     /**
   180 
   178     * if the playlsit exist in the MPX DB
   181     /**
   179     * @param aSuid, the suid of playlsit
   182      * if the playlsit exist in the MPX DB
   180     */
   183      * @param aSuid, the suid of playlsit
       
   184      */
   181     TBool IsExistL( const TDesC& aSuid );
   185     TBool IsExistL( const TDesC& aSuid );
   182 
   186 
   183 private:
   187 private:
   184     CMmMtpDpMetadataMpxAccess( RFs& aFs, MMTPDataProviderFramework& aFramework );
   188     CMmMtpDpMetadataMpxAccess( RFs& aFs,
       
   189         MMTPDataProviderFramework& aFramework );
   185 
   190 
   186     void ConstructL();
   191     void ConstructL();
   187 
   192 
   188     void SetDefaultL( CMPXMedia& aMediaProp );
   193     void SetDefaultL( CMPXMedia& aMediaProp );
   189 
   194 
   190     /**
   195     /**
   191     * Set property value into MPX object according to property code,
   196      * Set property value into MPX object according to property code,
   192     * only used by member functions of this class.
   197      * only used by member functions of this class.
   193     * @param aPropCode, specify property code of aMediaProp
   198      * @param aPropCode, specify property code of aMediaProp
   194     * @param aNewData, object property value which will be set into
   199      * @param aNewData, object property value which will be set into
   195     *     aObjectMetaData
   200      *     aObjectMetaData
   196     * @param aObjectMetaData, owner of the property which should be
   201      * @param aObjectMetaData, owner of the property which should be
   197     *     inserted or updated into database
   202      *     inserted or updated into database
   198     */
   203      */
   199     void SetMetadataValueL( const TUint16 aPropCode,
   204     void SetMetadataValueL( const TUint16 aPropCode,
   200             const MMTPType& aNewData,
   205         const MMTPType& aNewData,
   201             CMPXMedia& aMediaProp );
   206         CMPXMedia& aMediaProp );
   202 
   207 
   203     TMPXAttributeData MpxAttribFromPropL( const CMPXMedia& aMedia,
   208     TMPXAttributeData MpxAttribFromPropL( const TUint16 aPropCode );
   204             const TUint16 aPropCode );
       
   205 
   209 
   206     MMPXCollectionHelper* CollectionHelperL();
   210     MMPXCollectionHelper* CollectionHelperL();
   207 
   211 
   208 private:
   212 private:
   209     // File server to allow file access
   213     // File server to allow file access
   210     RFs& iRfs;
   214     RFs& iRfs;
   211 
   215 
   212     TBuf<KStorageRootMaxLength> iStoreRoot;
   216     TBuf<KStorageRootMaxLength> iStoreRoot;
   213 
   217 
   214     MMPXCollectionHelper* iCollectionHelper;
   218     MMPXCollectionHelper* iCollectionHelper;
   215     
   219 
   216     MMTPDataProviderFramework& iFramework;  
   220     MMTPDataProviderFramework& iFramework;
   217 
   221 
   218 #if defined(_DEBUG) || defined(MMMTPDP_PERFLOG)
   222 #if defined(_DEBUG) || defined(MMMTPDP_PERFLOG)
   219     CMmMtpDpPerfLog* iPerfLog;
   223     CMmMtpDpPerfLog* iPerfLog;
   220 #endif
   224 #endif
   221 
   225