mmappfw_plat/collection_helper_api/inc/mpxcollectionhelper.h
changeset 0 a2952bb97e68
equal deleted inserted replaced
-1:000000000000 0:a2952bb97e68
       
     1 /*
       
     2 * Copyright (c) 2007 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:  Collection helper abstract interface
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef MMPXCOLLECTIONHELPER_H
       
    21 #define MMPXCOLLECTIONHELPER_H
       
    22 
       
    23 #include <mpxmediageneraldefs.h>
       
    24 #include <mpxcollectionhelperobserver.h>
       
    25 
       
    26 // FORWARD DECLARATIONS
       
    27 class CMPXMedia;
       
    28 class TMPXAttribute;
       
    29 
       
    30 /**
       
    31  *  Abstract class for collection helper. Use this class to add or remove songs and playlists from
       
    32  *  Music Player and Podcast app.
       
    33  *
       
    34  *  @lib mpxcollectionhelper.lib
       
    35  */
       
    36 class MMPXCollectionHelper
       
    37     {
       
    38 
       
    39 public:
       
    40     /**
       
    41     * Add an item based on file path and use the harvester to parse the file.
       
    42     * On completion MMPXCollectionHelperObserver::HandleAddFileCompleteL() 
       
    43     * is called back.
       
    44     *
       
    45  	  * @since S60 3.2.3
       
    46     * @param aFile full path and name of the file.
       
    47     * @param aObserver observer for the add operation
       
    48     */
       
    49     virtual void AddL( const TDesC& aFile, 
       
    50                        MMPXCollectionHelperObserver* aObserver ) = 0;
       
    51 
       
    52     /**
       
    53     * Add an item (song or playlist) with some media properties registers with playlists.
       
    54  	  * @since S60 3.2.3
       
    55     * @param aMedia media property to add.
       
    56     * @leave KErrArgument leave if the given media doesn't contain the correct attributes
       
    57     */
       
    58     virtual void AddL( CMPXMedia* aMedia ) = 0;
       
    59 
       
    60     /**
       
    61     * Remove a song, playlist, m3u file from the collection and from the harvester database.
       
    62  	  * @since S60 3.2.3
       
    63     * @param aFile file to remove.
       
    64     * @param aItemCat type of the item (optional).
       
    65     * @leave KErrArgument leave if the file to be removed does not exist
       
    66     */
       
    67     virtual void RemoveL( const TDesC& aFile, TMPXGeneralCategory aItemCat = EMPXSong) = 0; //lint !e1735
       
    68 
       
    69     /**
       
    70     * Remove all entries from the music, podcast and harvester databases.
       
    71  	  * @since S60 3.2.3
       
    72     */
       
    73     virtual void RemoveAllL() = 0;
       
    74     
       
    75     /**
       
    76     * Delete all records that have been marked as deleted.
       
    77  	  * @since S60 3.2.3
       
    78     * @leave KErrNotSupported Virtual Void function that will leave if called and not implemented
       
    79     */
       
    80     virtual void CleanupDeletedMediasL() = 0;
       
    81        
       
    82     /**
       
    83     * Updates the metadata for a file based on the path.
       
    84  	  * @since S60 3.2.3
       
    85     * @param aMedia media item to update.
       
    86     * @leave KErrArgument leave if the given media doesn't contain the correct attributes
       
    87     * 		or leave if not updating a song or a playlist
       
    88     */
       
    89     virtual void SetL( CMPXMedia*& aMedia ) = 0;
       
    90 
       
    91     /**
       
    92     * Renames a file.
       
    93  	  * @since S60 3.2.3
       
    94     * @param aOldUri existing URI of the file to be renamed.
       
    95     * @param aNewUri new URI of the file.
       
    96     * @param aItemCat category of the file either EMPXSong
       
    97     *        or EMPXPlaylist.
       
    98     * @leave KErrArgument leave if not updating a song or a playlist
       
    99     */
       
   100     virtual void RenameL( const TDesC& aOldUri,
       
   101                           const TDesC& aNewUri,
       
   102                           TMPXGeneralCategory aItemCat = EMPXSong ) = 0; //lint !e1735
       
   103     
       
   104     /**
       
   105     * Gets the metadata for a file.
       
   106  	  * @since S60 3.2.3
       
   107     * @param aFile path to the file.
       
   108     * @param aAttrs attributes to return.
       
   109     * @param aItemCat category of the file either EMPXSong
       
   110     *        or EMPXPlaylist.
       
   111     * @return Media object representing the given file with
       
   112     *         the requested attributes.    
       
   113     * @leave KErrArgument leave if not updating a song or a playlist.
       
   114     * @leave KErrNoMemory leave if search array is empty.
       
   115     * @leave KErrNotFound leave if array indexcount is 0.
       
   116     * @leave KErrCorrupt default case if the above conditions are not satisfied 
       
   117     * 		and object is not found
       
   118     */
       
   119     virtual CMPXMedia* GetL( const TDesC& aFile, 
       
   120                              const TArray<TMPXAttribute>& aAttrs,
       
   121                              TMPXGeneralCategory aItemCat = EMPXSong ) = 0; //lint !e1735
       
   122 
       
   123     /**
       
   124     * Gets the metadata for a file.
       
   125  	  * @since S60 3.2.3
       
   126     * @param aFile path to the file.
       
   127     * @param aItemCat category of the file either EMPXSong
       
   128     *        or EMPXPlaylist.
       
   129     * @return Media object representing the given file.
       
   130     * @leave KErrNotSupported Virtual const function that will leave if called and not implemented
       
   131     */
       
   132     virtual const CMPXMedia& GetL( const TDesC& aFile, 
       
   133                                    TMPXGeneralCategory aItemCat = EMPXSong ) = 0; //lint !e1735
       
   134         
       
   135     /**
       
   136     * Generic find function.
       
   137  	  * @since S60 3.2.3
       
   138     * @param aCriteria criterias to search upon.
       
   139     * @param aAttrs attributes to return.
       
   140     * @return Search results. found media(s) are accessible
       
   141     *         through KMPXMediaIdContainer/EMPXMediaArrayContents
       
   142     *         attribute    
       
   143     */
       
   144     virtual CMPXMedia* FindAllL( CMPXMedia& aCriteria, 
       
   145                                  const TArray<TMPXAttribute>& aAttrs) = 0;
       
   146     
       
   147     /**
       
   148     * Close the helper. 
       
   149     * @since S60 3.2.3
       
   150     */                
       
   151     virtual void Close() = 0;
       
   152     };
       
   153        
       
   154 #endif // MMPXCOLLECTIONHELPER_H