mds_plat/harvester_framework_api/inc/composerplugin.h
changeset 60 79f826a55db2
parent 0 c53acadfccc6
equal deleted inserted replaced
58:fe894bb075c2 60:79f826a55db2
       
     1 /*
       
     2 * Copyright (c) 2006-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:  Composer Plug-in ECom interface
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef __CCOMPOSERPLUGIN_H__
       
    19 #define __CCOMPOSERPLUGIN_H__
       
    20 
       
    21 #include <e32base.h>
       
    22 #include <ecom.h>
       
    23 #include <badesca.h>
       
    24 
       
    25 #include <mdesession.h>
       
    26 
       
    27 /** @var Uid for this interface */
       
    28 const TUid KCComposerPluginInterfaceUid = { 0x2000717E };
       
    29 
       
    30  /**
       
    31  * Composer Plug-in ECom interface definition. Composer plug-in implementation
       
    32  * needs to inherit this class and implement the pure virtual methods which exist 
       
    33  * in this interface.
       
    34  *
       
    35  * Example:
       
    36  *
       
    37  * class CMyVideoComposerPlugin: public CComposerPlugin
       
    38  *     {
       
    39  *     protected:
       
    40  *         void SetObservers();    
       
    41  *         void RemoveObservers();
       
    42  * 
       
    43  *         // Because CComposerPlugin inherits MMdEObjectObserver
       
    44  *         void HandleObjectNotification(CMdESession& aSession, 
       
    45  *				TObserverNotificationType aType,
       
    46  *				const RArray<TItemId>& aObjectIdArray);
       
    47  *     
       
    48  *     private:
       
    49  *         // Active object which does the actual binary writing
       
    50  *         // so that this interface and its observers remain responsive
       
    51  *         CMyVideoComposerAO* iVideoComposerAO;       
       
    52  *     }
       
    53  *
       
    54  * void SetObservers()
       
    55  *     {
       
    56  *	   // We want to listen to changes in Video metadata objects
       
    57  *     // and setup an observer for this  
       
    58  *     CMdENamespaceDef& defaultNamespace = iSession->GetDefaultNamespaceDefL();
       
    59  *     CMdEObjectDef& videoDef = 
       
    60  *        defaultNamespace.GetObjectDefL( MdeConstants::Video::KVideoObject );
       
    61  *     CMdELogicCondition* condition = CMdELogicCondition::NewL( ELogicConditionOperatorAnd );
       
    62  *     condition->AddObjectConditionL( videoDef );
       
    63  *       
       
    64  *     // iSession is reference to CMdESession which is always set in CComposerPlugin::SetSession()
       
    65  *     iSession->AddObjectObserverL( *this, condition, ENotifyModify, &defaultNamespace );
       
    66  *     }
       
    67  * 
       
    68  * void RemoveObservers()
       
    69  *     {
       
    70  *     iSession->RemoveObjectObserverL( *this )
       
    71  *     }
       
    72  *
       
    73  * void CComposerImagePlugin::HandleObjectNotification(CMdESession& aSession, 
       
    74  *		TObserverNotificationType aType, const RArray<TItemId>& aObjectIdArray)
       
    75  *     {
       
    76  *     // We give ID-array of changed Video objects to our active object
       
    77  *     // which adds then to a its internal queue and processes them one-by-one 
       
    78  *     // with different RunL-calls so that we don't stuck the thread by composing
       
    79  *     // for example 1000 binary files in a row.
       
    80  *     iVideoComposerAO->AddToQueue( aObjectIdArray );
       
    81  *     }
       
    82  */
       
    83 class CComposerPlugin : public CBase, public MMdEObjectObserver
       
    84     {
       
    85     public:
       
    86 
       
    87         /**
       
    88          * Construction.
       
    89          *
       
    90          * @param aUid  Implementation UID which plug-in to invoke.
       
    91          */
       
    92         IMPORT_C static CComposerPlugin* NewL( const TUid& aUid );
       
    93 
       
    94         /**
       
    95          * Lists all available implementations which satisfy this given interface.
       
    96          * 
       
    97          * @param aImplInfoArray  Reference to a list which will be populated with 
       
    98          *                        plug-in implementation details. 
       
    99          */
       
   100         IMPORT_C static void ListImplementationsL(RImplInfoPtrArray& aImplInfoArray);
       
   101 
       
   102         /**
       
   103          * Destructor.
       
   104          */ 
       
   105         IMPORT_C virtual ~CComposerPlugin();
       
   106 
       
   107         /**
       
   108          * Sets Mde session to be used.
       
   109          * 
       
   110          * @param aSession  Open MdE session to utilize in the Composer plug-in
       
   111          */
       
   112         IMPORT_C void SetSession( CMdESession& aSession );
       
   113 
       
   114         /**
       
   115          * Unsets Mde session.
       
   116          */
       
   117         IMPORT_C void RemoveSession();
       
   118 
       
   119         /**
       
   120          * Checks if composing is completed.
       
   121          *
       
   122          * @return  Whether composing is on-going
       
   123          */
       
   124         virtual TBool IsComposingComplete() = 0;
       
   125 
       
   126     protected:
       
   127     
       
   128         /**
       
   129          * Sets observers to be notified. Called by the interface itself when
       
   130          * SetSession method is called from Harvester server side.
       
   131          */
       
   132         virtual void SetObservers() = 0;
       
   133 
       
   134         /**
       
   135          * Unsets observers. Called by the interface itself when
       
   136          * RemoveSession method is called from Harvester server side.
       
   137          */
       
   138         virtual void RemoveObservers() = 0;
       
   139 
       
   140     protected:
       
   141 
       
   142         /* Pointer to Mde session used by the plugin */
       
   143     CMdESession* iSession;
       
   144 
       
   145     private:
       
   146 
       
   147         /* Identification on cleanup */
       
   148         TUid iDtor_ID_Key;
       
   149     };
       
   150 
       
   151 #endif // __CCOMPOSERPLUGIN_H__