mpxplugins/serviceplugins/collectionplugins/mpxinmemoryplugin/inc/mpxinmemoryplugin.h
changeset 0 ff3acec5bc43
equal deleted inserted replaced
-1:000000000000 0:ff3acec5bc43
       
     1 /*
       
     2 * Copyright (c) 2006 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:  Simple plugin to cache media objects
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef CMPXINMEMORYPLUGIN_H
       
    21 #define CMPXINMEMORYPLUGIN_H
       
    22 
       
    23 // INCLUDES
       
    24 #include <e32cmn.h>
       
    25 #include <mpxcollectionplugin.h>
       
    26 #include <mpxcollectionmessagedefs.h>
       
    27 
       
    28 // FORWARD DECLARATIONS
       
    29 class CMPXMedia;
       
    30 class CMPXMediaArray;
       
    31 class CMPXDrmMediaUtility;
       
    32 
       
    33 // CONSTANTS
       
    34 
       
    35 // CLASS DECLARATION
       
    36 
       
    37 /**
       
    38 *  CMPXInMemoryPlugin class 
       
    39 *
       
    40 *  Plug-in basically provides temporary in memory browsing
       
    41 *  @lib mpxinmemoryplugin.lib
       
    42 */
       
    43 NONSHARABLE_CLASS(CMPXInMemoryPlugin) : public CMPXCollectionPlugin
       
    44     {
       
    45 public: // Constructors and destructor
       
    46 
       
    47     
       
    48     /**
       
    49     * Two-phased constructor
       
    50     *
       
    51     * @param aInitParams, initialization parameter
       
    52     * @return object of constructed
       
    53     */
       
    54     static CMPXInMemoryPlugin* NewL();
       
    55 
       
    56     /**
       
    57     * Destructor
       
    58     */
       
    59     virtual ~CMPXInMemoryPlugin();
       
    60     
       
    61 protected: // Functions from base classes
       
    62     /**
       
    63     *  from CMPXCollectionPlugin
       
    64     */
       
    65 
       
    66     /** 
       
    67     * From CMPXCollectionPlugin
       
    68     * Navigates to the given path
       
    69     * @param aPath: a path
       
    70     * @param aAttrs, attributes requested
       
    71     * @param aFilter, filter to apply or NULL if none
       
    72     */
       
    73     void OpenL(const CMPXCollectionPath& aPath,
       
    74                const TArray<TMPXAttribute>& aAttrs,
       
    75                CMPXFilter* aFilter); 
       
    76     
       
    77     /**
       
    78     * From CMPXCollectionPlugin     
       
    79     * Get the extended properties of the current file (async)
       
    80     * @param aPath: a path   
       
    81     * @param aAttrs: array of attributes requested             
       
    82     * @param aCaps platsec capabilities of client requesting media; plug-in should also
       
    83     *        verify its process capabilities
       
    84     * @aParam aSpecs, specifications for attributes
       
    85     */
       
    86     void MediaL(const CMPXCollectionPath& aPath, 
       
    87                 const TArray<TMPXAttribute>& aAttrs,
       
    88                 const TArray<TCapability>& aCaps,
       
    89                 CMPXAttributeSpecs* aSpecs);
       
    90             
       
    91     /** 
       
    92     * Cancel outstanding request
       
    93     */
       
    94     void CancelRequest();
       
    95 
       
    96     /** 
       
    97     * Executes a command on the selected collection
       
    98     *
       
    99     * @param aCmd a command
       
   100     */
       
   101     void CommandL(TMPXCollectionCommand aCmd, TInt aArg);
       
   102 
       
   103     /**
       
   104     * From CMPXCollectionPlugin
       
   105     */
       
   106     void CommandL(CMPXCommand& aCmd);
       
   107     
       
   108     /**
       
   109     *  Adds item(s) to the collection
       
   110     *
       
   111     *  @param aNewProperties, Properties of the item
       
   112     */
       
   113     void AddL(const CMPXMedia& aNewMedia);
       
   114     
       
   115     /**
       
   116     * Remove a collection path
       
   117     * @param aPath, path to remove
       
   118     *
       
   119     */
       
   120     void RemoveL(const CMPXCollectionPath& aPath );
       
   121     
       
   122     /**
       
   123     *  Remove an item or items from the collection
       
   124     *
       
   125     *  @param aProperties, Properties of the item. It may cantain URI only
       
   126     *                      or meta data, all of items matched properties 
       
   127     *                      will be removed.
       
   128     */
       
   129     void RemoveL(const CMPXMedia& aMedia);
       
   130     
       
   131     /**
       
   132     *  Sets/updates the media for the item
       
   133     *  specified in the path
       
   134     *
       
   135     *  @param aMedia, new value
       
   136     */
       
   137     void SetL(const CMPXMedia& aMedia);
       
   138     
       
   139     /**
       
   140     *  Find a list of items matched 
       
   141     *
       
   142     *  @param aMedia, properties to be searched
       
   143     *  @param aAttrs, attributes to return from find
       
   144     */
       
   145     void FindAllL(const CMPXMedia& aMedia, const TArray<TMPXAttribute>& aAttrs);
       
   146 
       
   147     /**
       
   148     * Find a list of items matched (sync)
       
   149     *
       
   150     *  @param aMedia, properties to be searched
       
   151     *  @param aAttrs, attributes to return
       
   152     *  @return results of the search        
       
   153     */
       
   154     CMPXMedia* FindAllSyncL(const CMPXMedia& aMedia,
       
   155                             const TArray<TMPXAttribute>& aAttrs);
       
   156                             
       
   157     /**
       
   158     * Get the list of supported capabilities
       
   159     *
       
   160     * @return TCollectionCapability, bitmask of supported capabilities
       
   161     */
       
   162     TCollectionCapability GetCapabilities();
       
   163                         
       
   164 protected: // New Functions
       
   165     
       
   166     /**
       
   167     * Send change events back to the observer
       
   168     * @param aId, embedded context that was changed
       
   169     * @param aChange, change type
       
   170     */
       
   171     void HandleChangeL(const TMPXItemId& aId, TMPXChangeEventType aChange );
       
   172 
       
   173     /**
       
   174     * Internal function to Add a Media
       
   175     * @param aMedia media to add
       
   176     */
       
   177     void DoAddL( const CMPXMedia& aMedia );
       
   178     
       
   179     /**
       
   180     * Internal function to Set a Media
       
   181     * @param aMedia media to set
       
   182     */
       
   183     void DoSetL( const CMPXMedia& aMedia );
       
   184         
       
   185 protected: 
       
   186     /**
       
   187     * Constructor
       
   188     */
       
   189     CMPXInMemoryPlugin();
       
   190     
       
   191     /**
       
   192     *  2nd phase constructor
       
   193     */
       
   194     void ConstructL();
       
   195     
       
   196 protected:
       
   197     CMPXDrmMediaUtility*     iDrmMediaUtility;
       
   198     RPointerArray<CMPXMedia> iTemporaryData;
       
   199     RArray<TInt>             iEmbeddedContext;
       
   200     };
       
   201 
       
   202 #endif      // CMPXINMEMORYPLUGIN_H
       
   203