sysanadatacapture/piprofiler/piprofiler_api/inc/WriterPluginInterface.h
changeset 1 3ff3fecb12fe
equal deleted inserted replaced
0:f0f2b8682603 1:3ff3fecb12fe
       
     1 /*
       
     2 * Copyright (c) 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:  
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef __WRITERPLUGIN_INTERFACE__
       
    20 #define __WRITERPLUGIN_INTERFACE__
       
    21 
       
    22 #include <e32base.h>
       
    23 #include <ecom/ECom.h>
       
    24 #include <badesca.h>
       
    25 
       
    26 
       
    27 // Constant for indexing (iOrder):
       
    28 const TInt KWriterPluginNotIndexed      = -1;
       
    29 
       
    30 /**
       
    31  * Constant:    KWriterPluginInterfaceUid
       
    32  *
       
    33  * Description: UID of this ECOM interface. It should be unique in the system.
       
    34  *              It is used to identify this specific custom interface.
       
    35  *              Implementations of this interface will use this ID, when they
       
    36  *              publish the implementation. Clients use this UID to search for
       
    37  *              implementations for this interface (the
       
    38  *              EcomInterfaceDefinition.inl does this).
       
    39  */
       
    40 const TUid KWriterPluginInterfaceUid = {0x2001E5BD};
       
    41 
       
    42 /**
       
    43 * Used by GetValue(). These are the keys for retrieving a specific
       
    44 * value. This enum can be extended to provide other values as well as
       
    45 * long as the original keys are not changed.
       
    46 */
       
    47 enum TWriterPluginValueKeys
       
    48     {
       
    49     EWriterPluginKeySettingsItemValueString = 1,
       
    50     EWriterPluginSettings,
       
    51     EWriterPluginEnabled,
       
    52     EWriterPluginDisabled,
       
    53     EWriterPluginType,
       
    54     EWriterPluginVersion
       
    55     };
       
    56 /**
       
    57  *
       
    58  * Description: UID of this ECOM interface. It should be unique in the system.
       
    59  *
       
    60  */
       
    61     
       
    62 /**
       
    63  * Class:       CWriterInterfaceDefinition
       
    64  *
       
    65  * Description: Custom ECOM interface definition. This interface is used by
       
    66  *              clients to find specific instance and do corresponding
       
    67  *              calculation operation for given too numbers. Plugin
       
    68  *              implementations implement the Calculate function.
       
    69  */
       
    70 
       
    71 class CProfilerSampleStream;
       
    72 
       
    73 class CWriterPluginInterface : public CBase
       
    74     {
       
    75 
       
    76     // CSamplerPluginLoader accesses iOrder which should not be accessed outside.
       
    77     friend class CWriterPluginLoader;
       
    78 
       
    79 public: // Wrapper functions to handle ECOM "connectivity".
       
    80         // These are implemented in EComInterfaceDefinition.inl.
       
    81         // These functions are used only by the client.
       
    82     /**
       
    83      * Function:   NewL
       
    84      *
       
    85      * Description: Wraps ECom object instantitation. Will search for
       
    86      *              interface implementation, which matches to given
       
    87      *              aOperationName.
       
    88      *
       
    89      * Param:       aOperationName name of requested implementation.
       
    90      *              Implementations advertise their "name" as specified
       
    91      *              in their resource file field
       
    92      *                 IMPLEMENTATION_INFO::default_data.
       
    93      *              For details, see EcomInterfaceDefinition.inl comments.
       
    94      *              In this example, the allowed values are "sum" and
       
    95      *              "multiply".
       
    96      *
       
    97      * Note:        This is not a "normal" NewL method, since normally NewL
       
    98      *              methods are only defined for concrete classes.
       
    99      *              Note that also implementations of this interface provide
       
   100      *              NewL methods. They are the familiar NewL's, which create
       
   101      *              instance of classes.
       
   102      */
       
   103     static CWriterPluginInterface* NewL(const TUid aImplementationUid, TAny* aInitParams);
       
   104 
       
   105     /**
       
   106      * Function:   ~CWriterPluginInterface
       
   107      *
       
   108      * Description: Wraps ECom object destruction. Notifies the ECOM
       
   109      *              framework that specific instance is being destroyed.
       
   110      *              See EcomInterfaceDefinition.inl for details.
       
   111      */
       
   112     virtual ~CWriterPluginInterface();
       
   113 protected: // New
       
   114 
       
   115         /**
       
   116         * C++ constructor.
       
   117         */
       
   118         CWriterPluginInterface();
       
   119        
       
   120 public: 
       
   121      /**
       
   122       * Method for getting caption of this plugin. This should be the
       
   123       * localized name of the settings view to be shown in parent view.
       
   124       *
       
   125       * @param aCaption pointer to Caption variable
       
   126       */
       
   127 	 virtual TInt 	Start() = 0;
       
   128 	 
       
   129 	 virtual void 	Stop() = 0;
       
   130     
       
   131 	 virtual void 	GetCaption( TDes& aCaption ) const = 0;
       
   132 
       
   133 	 virtual TUid 	Id() const = 0;
       
   134 	 
       
   135 	 virtual void 	GetValue( const TWriterPluginValueKeys aKey, TDes& aValue ) = 0;
       
   136 	 
       
   137 	 virtual void 	SetValue( const TWriterPluginValueKeys aKey, TDes& aValue ) = 0;
       
   138 	
       
   139 	 virtual void 	GetWriterVersion(TDes* aDes) = 0;
       
   140 
       
   141 	 virtual TUint32 GetWriterType() = 0;
       
   142 
       
   143 	 virtual TBool GetEnabled() = 0;
       
   144 
       
   145      virtual void   WriteData() = 0;
       
   146      virtual void   SetStream( CProfilerSampleStream& aStream ) = 0;
       
   147      
       
   148 	 // internal inline functions
       
   149 	 inline static void ListAllImplementationsL( RImplInfoPtrArray& aImplInfoArray );
       
   150      inline void    SetOrder( TInt aOrder );
       
   151      
       
   152 private:
       
   153 
       
   154     /** iDtor_ID_Key Instance identifier key. When instance of an
       
   155     * implementation is created by ECOM framework, the
       
   156     * framework will assign UID for it. The UID is used in
       
   157     * destructor to notify framework that this instance is
       
   158     * being destroyed and resources can be released.
       
   159     */
       
   160     TUid iDtor_ID_Key;
       
   161     
       
   162     /**
       
   163     * Index of the plugin in listbox. Used for CSamplerPluginLoader. Default
       
   164     * value is KSamplerPluginNotIndexed which means not ordered. This value is
       
   165     * read, if defined, from the opaque_data field of the plugin's resource
       
   166     * definition. Index starts from 0.
       
   167     */
       
   168     TInt iOrder;
       
   169 public:
       
   170 	TInt	                      iAdditionalSettings;	
       
   171 	TBool                         isEnabled;
       
   172     };
       
   173 
       
   174 #include <piprofiler/WriterPluginInterface.inl>
       
   175 
       
   176 #endif // __WRITERPLUGIN_INTERFACE__