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 __SAMPLER_PLUGIN_INTERFACE__
|
|
20 |
#define __SAMPLER_PLUGIN_INTERFACE__
|
|
21 |
|
|
22 |
#include <e32base.h>
|
|
23 |
#include <ecom/ecom.h>
|
|
24 |
#include <badesca.h>
|
|
25 |
#include <piprofiler/ProfilerAttributes.h> // internal settings format presentations
|
|
26 |
|
|
27 |
|
|
28 |
// Constant for indexing (iOrder):
|
|
29 |
const TInt KSamplerPluginNotIndexed = -1;
|
|
30 |
|
|
31 |
/**
|
|
32 |
* Constant: KSamplerPluginInterfaceUid
|
|
33 |
*
|
|
34 |
* Description: UID of this ECOM interface. It should be unique in the system.
|
|
35 |
* It is used to identify this specific custom interface.
|
|
36 |
* Implementations of this interface will use this ID, when they
|
|
37 |
* publish the implementation. Clients use this UID to search for
|
|
38 |
* implementations for this interface (the
|
|
39 |
* EcomInterfaceDefinition.inl does this).
|
|
40 |
*/
|
|
41 |
const TUid KSamplerPluginInterfaceUid = {0x2001E5BC};
|
|
42 |
|
|
43 |
/**
|
|
44 |
*
|
|
45 |
* Description: UID of this ECOM interface. It should be unique in the system.
|
|
46 |
*
|
|
47 |
*/
|
|
48 |
enum TGenericSettingTypes
|
|
49 |
{
|
|
50 |
EEnablePlugin,
|
|
51 |
EOutputSettings,
|
|
52 |
ESaveDrive,
|
|
53 |
EFilePrefix,
|
|
54 |
ETracingMode
|
|
55 |
};
|
|
56 |
|
|
57 |
|
|
58 |
enum TSamplerCaptionTypes
|
|
59 |
{
|
|
60 |
ECaptionLengthShort,
|
|
61 |
ECaptionLengthMedium,
|
|
62 |
ECaptionLengthLong,
|
|
63 |
ESettingsCaption
|
|
64 |
};
|
|
65 |
|
|
66 |
|
|
67 |
/**
|
|
68 |
* Used by GetValue(). These are the keys for retrieving a specific
|
|
69 |
* value. This enum can be extended to provide other values as well as
|
|
70 |
* long as the original keys are not changed.
|
|
71 |
*/
|
|
72 |
enum TSamplerPluginValueKeys
|
|
73 |
{
|
|
74 |
|
|
75 |
ESamplerPluginKeySettingsItemValueString = 1,
|
|
76 |
ESamplerPluginSettings,
|
|
77 |
ESamplerPluginEnabled,
|
|
78 |
ESamplerPluginDisabled,
|
|
79 |
ESamplerPluginType,
|
|
80 |
ESamplerPluginVersion
|
|
81 |
};
|
|
82 |
|
|
83 |
|
|
84 |
/**
|
|
85 |
* Class: CSamplerInterfaceDefinition
|
|
86 |
*
|
|
87 |
* Description: Custom ECOM interface definition. This interface is used by
|
|
88 |
* clients to find specific instance and do corresponding
|
|
89 |
* calculation operation for given too numbers. Plugin
|
|
90 |
* implementations implement the Calculate function.
|
|
91 |
*/
|
|
92 |
class TBapBuf;
|
|
93 |
class CProfilerSampleStream;
|
|
94 |
|
|
95 |
class CSamplerPluginInterface : public CBase
|
|
96 |
{
|
|
97 |
|
|
98 |
// CSamplerPluginLoader accesses iOrder which should not be accessed outside.
|
|
99 |
friend class CSamplerPluginLoader;
|
|
100 |
|
|
101 |
public:
|
|
102 |
// Wrapper functions to handle ECOM "connectivity".
|
|
103 |
// These are implemented in EComInterfaceDefinition.inl.
|
|
104 |
// These functions are used only by the client.
|
|
105 |
|
|
106 |
/**
|
|
107 |
* Function: NewL
|
|
108 |
*
|
|
109 |
* Description: Wraps ECom object instantitation. Will search for
|
|
110 |
* interface implementation, which matches to given
|
|
111 |
* aOperationName.
|
|
112 |
*
|
|
113 |
* Param: aOperationName name of requested implementation.
|
|
114 |
* Implementations advertise their "name" as specified
|
|
115 |
* in their resource file field
|
|
116 |
* IMPLEMENTATION_INFO::default_data.
|
|
117 |
* For details, see EcomInterfaceDefinition.inl comments.
|
|
118 |
* In this example, the allowed values are "sum" and
|
|
119 |
* "multiply".
|
|
120 |
*
|
|
121 |
* Note: This is not a "normal" NewL method, since normally NewL
|
|
122 |
* methods are only defined for concrete classes.
|
|
123 |
* Note that also implementations of this interface provide
|
|
124 |
* NewL methods. They are the familiar NewL's, which create
|
|
125 |
* instance of classes.
|
|
126 |
*/
|
|
127 |
static CSamplerPluginInterface* NewL(const TUid aImplementationUid, TAny* aInitParams);
|
|
128 |
|
|
129 |
/**
|
|
130 |
* Function: ~CSamplerPluginInterface
|
|
131 |
*
|
|
132 |
* Description: Wraps ECom object destruction. Notifies the ECOM
|
|
133 |
* framework that specific instance is being destroyed.
|
|
134 |
* See EcomInterfaceDefinition.inl for details.
|
|
135 |
*/
|
|
136 |
virtual ~CSamplerPluginInterface();
|
|
137 |
protected: // New
|
|
138 |
|
|
139 |
/**
|
|
140 |
* C++ constructor.
|
|
141 |
*/
|
|
142 |
CSamplerPluginInterface();
|
|
143 |
|
|
144 |
public:
|
|
145 |
// Public pure virtual functions, which are implemented by
|
|
146 |
// interface implementations (See ..\plugin)
|
|
147 |
|
|
148 |
/**
|
|
149 |
* Method for initializing and starting of profiling in single plugin implementation
|
|
150 |
* @param aStream is a data stream to store the gathered data, provided by engine
|
|
151 |
* @return TInt if no error KErrNone, else any of system-wide errors
|
|
152 |
*/
|
|
153 |
virtual TInt ResetAndActivateL(CProfilerSampleStream& aStream) = 0;
|
|
154 |
|
|
155 |
/**
|
|
156 |
* Method for stopping of profiling in single plugin implementation
|
|
157 |
* @return TInt if no error KErrNone, else any of system-wide errors
|
|
158 |
*/
|
|
159 |
virtual TInt StopSampling() = 0;
|
|
160 |
|
|
161 |
/**
|
|
162 |
* Method for checking if plugin is enabled
|
|
163 |
* @return TBool if enabled return ETrue else EFalse
|
|
164 |
*/
|
|
165 |
virtual TBool Enabled() = 0;
|
|
166 |
|
|
167 |
/**
|
|
168 |
* Method for getting an array of sampler attributes, size of an array: 1...n
|
|
169 |
* @return array of settings of one or several sampler plugins
|
|
170 |
*/
|
|
171 |
virtual void GetAttributesL(CArrayFixFlat<TSamplerAttributes>* aAttributeArray) = 0;
|
|
172 |
|
|
173 |
/**
|
|
174 |
* Method for setting configurations of single sampler attributes
|
|
175 |
* @param aAttributes contains settings of a single sampler plugin
|
|
176 |
*/
|
|
177 |
virtual TInt SetAttributesL(TSamplerAttributes aAttributes) = 0;
|
|
178 |
|
|
179 |
/**
|
|
180 |
* Method for parsing text formatted settings block and converting
|
|
181 |
* it to TSamplerAttributes data structure
|
|
182 |
* @param aSingleSettingArray containing setting lines of a single sampler
|
|
183 |
* @return status of conversion, if success KErrNone, else KErrGeneral
|
|
184 |
*/
|
|
185 |
virtual TInt ConvertRawSettingsToAttributes(CDesC8ArrayFlat* aSingleSettingArray) = 0;
|
|
186 |
|
|
187 |
/**
|
|
188 |
* Method for getting UID of this plugin.
|
|
189 |
* @param aSubId the implementation id of sub sampler
|
|
190 |
* @returns uid of sampler or sub sampler, if aSubId -1 uid of sampler, else uid of sub sampler
|
|
191 |
*/
|
|
192 |
virtual TUid Id(TInt aSubId) const = 0;
|
|
193 |
|
|
194 |
/**
|
|
195 |
* Method for getting locally defined sub ID value inside a specific plug-in.
|
|
196 |
* @param aUid of a specific sampler
|
|
197 |
* @returns local ID of sampler or sub sampler
|
|
198 |
*/
|
|
199 |
virtual TInt SubId(TUid aUid) const = 0;
|
|
200 |
|
|
201 |
/**
|
|
202 |
* Method for getting sampler type.
|
|
203 |
* @returns PROFILER_USER_MODE_SAMPLER, PROFILER_KERNEL_MODE_SAMPLER or PROFILER_DUMMY_MODE_SAMPLER
|
|
204 |
*/
|
|
205 |
virtual TInt GetSamplerType() = 0;
|
|
206 |
|
|
207 |
|
|
208 |
// some internal inline methods, used by engine
|
|
209 |
inline TInt Flush();
|
|
210 |
inline TInt AddSample(TUint8* sample, TUint32 length, TInt limitSize);
|
|
211 |
inline void SetOrder( TInt aOrder );
|
|
212 |
inline static void ListAllImplementationsL(RImplInfoPtrArray& aImplInfoArray);
|
|
213 |
|
|
214 |
/**
|
|
215 |
* Static methods for getting setting value out of descriptor
|
|
216 |
*
|
|
217 |
* @param aBuf buffer where to convert the value
|
|
218 |
* @param aValue parameter where to store the requested type of value
|
|
219 |
*/
|
|
220 |
inline static void Str2Bool(const TDesC8& aBuf, TBool& aValue);
|
|
221 |
inline static void Str2Int(const TDesC8& aBuf, TInt& aValue);
|
|
222 |
inline static void Str2Int(const TDesC8& aBuf, TUint32& aValue);
|
|
223 |
|
|
224 |
/** iDtor_ID_Key Instance identifier key. When instance of an
|
|
225 |
* implementation is created by ECOM framework, the
|
|
226 |
* framework will assign UID for it. The UID is used in
|
|
227 |
* destructor to notify framework that this instance is
|
|
228 |
* being destroyed and resources can be released.
|
|
229 |
*/
|
|
230 |
TUid iDtor_ID_Key;
|
|
231 |
|
|
232 |
/**
|
|
233 |
* Index of the plugin in listbox. Used for CSamplerPluginLoader. Default
|
|
234 |
* value is KSamplerPluginNotIndexed which means not ordered. This value is
|
|
235 |
* read, if defined, from the opaque_data field of the plugin's resource
|
|
236 |
* definition. Index starts from 0.
|
|
237 |
*/
|
|
238 |
TInt iOrder;
|
|
239 |
|
|
240 |
public:
|
|
241 |
TInt iSamplerType;
|
|
242 |
|
|
243 |
// this variable must be defined by the extending classes!!
|
|
244 |
TInt iSamplerId;
|
|
245 |
|
|
246 |
CProfilerSampleStream* iStream;
|
|
247 |
TBool iEnabled;
|
|
248 |
|
|
249 |
private:
|
|
250 |
TBapBuf* iBuffer;
|
|
251 |
};
|
|
252 |
|
|
253 |
#include <piprofiler/ProfilerGenericClassesUsr.h>
|
|
254 |
#include <piprofiler/SamplerPluginInterface.inl>
|
|
255 |
|
|
256 |
|
|
257 |
#endif // __SAMPLER_PLUGIN_INTERFACE__
|