20
|
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 TUid Id() const = 0;
|
|
132 |
|
|
133 |
virtual void GetValue( const TWriterPluginValueKeys aKey, TDes& aValue ) = 0;
|
|
134 |
|
|
135 |
virtual void SetValue( const TWriterPluginValueKeys aKey, TDes& aValue ) = 0;
|
|
136 |
|
|
137 |
virtual void GetWriterVersion(TDes* aDes) = 0;
|
|
138 |
|
|
139 |
virtual TUint32 GetWriterType() = 0;
|
|
140 |
|
|
141 |
virtual TBool GetEnabled() = 0;
|
|
142 |
|
|
143 |
virtual void WriteData() = 0;
|
|
144 |
virtual void SetStream( CProfilerSampleStream& aStream ) = 0;
|
|
145 |
|
|
146 |
// internal inline functions
|
|
147 |
inline static void ListAllImplementationsL( RImplInfoPtrArray& aImplInfoArray );
|
|
148 |
inline void SetOrder( TInt aOrder );
|
|
149 |
|
|
150 |
private:
|
|
151 |
|
|
152 |
/** iDtor_ID_Key Instance identifier key. When instance of an
|
|
153 |
* implementation is created by ECOM framework, the
|
|
154 |
* framework will assign UID for it. The UID is used in
|
|
155 |
* destructor to notify framework that this instance is
|
|
156 |
* being destroyed and resources can be released.
|
|
157 |
*/
|
|
158 |
TUid iDtor_ID_Key;
|
|
159 |
|
|
160 |
/**
|
|
161 |
* Index of the plugin in listbox. Used for CSamplerPluginLoader. Default
|
|
162 |
* value is KSamplerPluginNotIndexed which means not ordered. This value is
|
|
163 |
* read, if defined, from the opaque_data field of the plugin's resource
|
|
164 |
* definition. Index starts from 0.
|
|
165 |
*/
|
|
166 |
TInt iOrder;
|
|
167 |
public:
|
|
168 |
TInt iAdditionalSettings;
|
|
169 |
TBool isEnabled;
|
|
170 |
};
|
|
171 |
|
|
172 |
#include <piprofiler/WriterPluginInterface.inl>
|
|
173 |
|
|
174 |
#endif // __WRITERPLUGIN_INTERFACE__
|