mpx/tsrc/public/basic/common/testplugins/testcollectionplugin/inc/testcollectionplugin.h
changeset 62 b276843a15ba
equal deleted inserted replaced
58:c76ea6caa649 62:b276843a15ba
       
     1 /*
       
     2 * Copyright (c) 2002 - 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:  Implementation of testcollectionplugin interface
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef TESTCOLLECTIONPLUGIN_H
       
    19 #define TESTCOLLECTIONPLUGIN_H
       
    20 
       
    21 // INCLUDES
       
    22 #include <mpxcommonframeworkdefs.h>
       
    23 #include <mpxcollectionframeworkdefs.h>
       
    24 #include <mpxmessagegeneraldefs.h>
       
    25 #include <mpxcollectionmessagedefs.h>
       
    26 #include <mpxcollectionplugin.h>
       
    27 #include <mpxcollectionpath.h>
       
    28 #include <mpxmediageneraldefs.h>
       
    29 #include <mpxmessage2.h>
       
    30 #include <badesca.h>
       
    31 
       
    32 // FORWARD DECLARATIONS
       
    33 class CMPXMedia;
       
    34 class CMPXMediaArray;
       
    35 
       
    36 // CONSTANTS
       
    37 
       
    38 // CLASS DECLARATION
       
    39 
       
    40 /**
       
    41 *  CCollectionTestPlugin class 
       
    42 *
       
    43 */
       
    44 NONSHARABLE_CLASS(CTestCollectionPlugin) : public CMPXCollectionPlugin
       
    45     {
       
    46 public: // Constructors and destructor
       
    47     
       
    48     /**
       
    49     * Two-phased constructor
       
    50     * @param aInitParams: initialization parameters
       
    51     * @return: object constructed
       
    52     */
       
    53     static CTestCollectionPlugin* NewL (TAny* aInitParams);
       
    54 
       
    55     /**
       
    56     * Destructor
       
    57     */
       
    58     virtual ~CTestCollectionPlugin();
       
    59     
       
    60 public: // from base clase
       
    61     /** 
       
    62     * From CMPXCollectionPlugin
       
    63     * Navigates to the given path
       
    64     * @param aPath: a path
       
    65     * @param aAttrs, attributes requested
       
    66     * @param aFilter, filter to apply or NULL if none
       
    67     */
       
    68     void OpenL(const CMPXCollectionPath& aPath,
       
    69                const TArray<TMPXAttribute>& aAttrs,
       
    70                CMPXFilter* aFilter); 
       
    71     
       
    72     /**
       
    73     * From CMPXCollectionPlugin     
       
    74     * Get the extended properties of the current file (async)
       
    75     * @param aPath: a path   
       
    76     * @param aAttrs: array of attributes requested             
       
    77     * @param aCaps platsec capabilities of client requesting media; plug-in should also
       
    78     *        verify its process capabilities
       
    79     * @aParam aSpecs, specifications for attributes
       
    80     */
       
    81     void MediaL(const CMPXCollectionPath& aPath, 
       
    82                 const TArray<TMPXAttribute>& aAttrs,
       
    83                 const TArray<TCapability>& aCaps,
       
    84                 CMPXAttributeSpecs* aSpecs);
       
    85 
       
    86     /**
       
    87     * From CMPXCollectionPlugin     
       
    88     * Cancel outstanding request
       
    89     */
       
    90     void CancelRequest ();
       
    91 
       
    92     /** 
       
    93     * From CMPXCollectionPlugin    
       
    94     * Executes the given command on the collection
       
    95     * @param aCmd: a command
       
    96     * @param aArg: a Argument
       
    97     */
       
    98     void CommandL (TMPXCollectionCommand aCmd, TInt aArg);
       
    99 
       
   100     /** 
       
   101     * From CMPXCollectionPlugin      
       
   102     * Executes a command
       
   103     *
       
   104     * @param aCmd a command
       
   105     */
       
   106     void CommandL(CMPXCommand& aCmd);
       
   107             
       
   108     /**
       
   109     * From CMPXCollectionPlugin        
       
   110     * Adds an item (song or playlist) to the collection
       
   111     * @param aMedia: Properties of the item
       
   112     */
       
   113     void AddL (const CMPXMedia& aMedia);
       
   114 
       
   115     /**
       
   116     * From CMPXCollectionPlugin        
       
   117     * Remove an item from the collection database using the given path
       
   118     * Note that the selection indicies are hidden within the path
       
   119     * @param aPath: path to the item to be removed
       
   120     * 
       
   121     */
       
   122     void RemoveL (const CMPXCollectionPath& aPath);
       
   123     
       
   124     /**
       
   125     * From CMPXCollectionPlugin        
       
   126     *  Remove an item from the collection database using the given media properties
       
   127     *  @param aMedia: Properties of the item that is to be removed. It may cantain URI only
       
   128     *                 or meta data, all of items matched properties will be removed.
       
   129     */
       
   130     void RemoveL (const CMPXMedia& aMedia);
       
   131     
       
   132     /**
       
   133     * From CMPXCollectionPlugin        
       
   134     *  Sets/updates the media for an item in the collection
       
   135     *  @param aMedia: new property values for the item
       
   136     */
       
   137     void SetL (const CMPXMedia& aMedia);
       
   138 
       
   139     /**
       
   140     * From CMPXCollectionPlugin        
       
   141     *  Find the items matching the media specifications 
       
   142     *  @param aCriteria: Properties of the item that is to be found
       
   143     *  @param aAttrs: Requested attributes to return   
       
   144     */
       
   145     void FindAllL (const CMPXMedia& aCriteria, const TArray<TMPXAttribute>& aAttrs);
       
   146 
       
   147     /**
       
   148     * From CMPXCollectionPlugin        
       
   149     *  Find the items matching the media specifications 
       
   150     *  @param aCriteria: Properties of the item that is to be found
       
   151     *  @param aAttrs: Requested attributes to return 
       
   152     *  @return results of the search
       
   153     */
       
   154     CMPXMedia* FindAllSyncL(const CMPXMedia& aCriteria,
       
   155                             const TArray<TMPXAttribute>& aAttrs);
       
   156                                         
       
   157     /**
       
   158     * From CMPXCollectionPlugin        
       
   159     * Get the list of supported capabilities
       
   160     * @return: TCollectionCapability, bitmask of supported capabilities
       
   161     */
       
   162     TCollectionCapability GetCapabilities ();    
       
   163                 
       
   164 private:
       
   165     /**
       
   166     * Constructor
       
   167     */
       
   168     CTestCollectionPlugin ();
       
   169 
       
   170     /**
       
   171     * Symbian 2nd phase constructor.
       
   172     */
       
   173     void ConstructL ();
       
   174     
       
   175     /**
       
   176     * Append media into aMediaArray base on aIdArray Info
       
   177     */
       
   178     void AddMediaL(CMPXMediaArray& aMediaArray, 
       
   179                    const RArray<TInt> aIdArray, 
       
   180                    const TArray<TMPXAttribute>& aAttrs);
       
   181     
       
   182     /**
       
   183     * Add specify attribute to Media
       
   184     */
       
   185     void AddAttrbuteL(CMPXMedia& aMedia, 
       
   186                       const TInt aId,
       
   187                       const TDesC& aTitle,
       
   188                       const TDesC& aUri,
       
   189                       const TArray<TMPXAttribute>& aAttrs);
       
   190 
       
   191     /**
       
   192     * Add specify attribute to Media specific for Playback framework
       
   193     * test cases
       
   194     */
       
   195     void AddAttributePlaybackFwTestL(CMPXMedia& aMedia, 
       
   196                                      const TInt aId,
       
   197                                      const TArray<TMPXAttribute>& aAttrs);
       
   198     /**
       
   199     * Filter out media in aMediaArray which match any one attribute in aFilter
       
   200     */                  
       
   201     void FilterMediaArray(CMPXMediaArray& aMediaArray, CMPXFilter* aFilter);
       
   202     
       
   203     /**
       
   204     * Fill up media with change message
       
   205     */
       
   206     void FillItemChangeMessageL(CMPXMessage& aMessage,
       
   207                                 TMPXItemId aId,
       
   208                                 TMPXChangeEventType aChangeType,
       
   209                                 TMPXGeneralCategory aCategory);
       
   210                                 
       
   211     /**
       
   212     * Adding specific attribute
       
   213     */
       
   214     void AddAttributeGeneralTypeL(CMPXMedia& aMedia, const TInt aId);
       
   215     void AddAttributeGeneralCategoryL(CMPXMedia& aMedia, const TInt aId);
       
   216     void AddAttributeGeneralDurationL(CMPXMedia& aMedia, const TInt aId);
       
   217     void AddAttributeGeneralLastPlaybackPositionL(CMPXMedia& aMedia, const TInt aId);
       
   218     void AddAttributeMusicArtistL(CMPXMedia& aMedia, const TInt aId);
       
   219     void AddAttributeDrmTypeL(CMPXMedia& aMedia, const TInt aId);
       
   220     void AddAttributeDrmProtectedL(CMPXMedia& aMedia, const TInt aId);
       
   221     void AddAttributeDrmRightsStatusL(CMPXMedia& aMedia, const TInt aId);
       
   222     
       
   223 private:    // data
       
   224     };
       
   225 
       
   226 #endif   // TESTCOLLECTIONPLUGIN_H
       
   227             
       
   228