51
|
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 PIPROFILER_BUPECOM_SAMPLER_H
|
|
20 |
#define PIPROFILER_BUPECOM_SAMPLER_H
|
|
21 |
|
|
22 |
#include <w32std.h>
|
|
23 |
#include <w32std.h> // RWsSession
|
|
24 |
#include <w32adll.h> // RAnim DLL
|
|
25 |
#include <e32std.h>
|
|
26 |
#include <e32property.h> // RProperty
|
|
27 |
|
|
28 |
#include <piprofiler/ProfilerTraces.h>
|
|
29 |
#include <piprofiler/ProfilerConfig.h>
|
|
30 |
#include <piprofiler/ProfilerVersion.h>
|
|
31 |
#include <piprofiler/SamplerPluginInterface.h>
|
|
32 |
#include <piprofiler/ProfilerGenericClassesUsr.h>
|
|
33 |
|
|
34 |
#include <data_caging_path_literals.hrh> // for KDC_SHARED_LIB_DIR
|
|
35 |
|
|
36 |
// Button press&touch event Anim DLL interface
|
|
37 |
#include "TouchEventClientDll.h"
|
|
38 |
|
|
39 |
// caption definitions
|
|
40 |
_LIT8(KBUPShortName, "bup");
|
|
41 |
_LIT8(KBUPLongName, "Button and touch event capture");
|
|
42 |
_LIT8(KBUPDescription, "Button and touch event sampler\nTracing button and touch screen events\nHW dep: N/A\nSW dep: S60 3.0\n");
|
|
43 |
|
|
44 |
const TUid KProfilerKeyEventPropertyCat={0x2001E5AD};
|
|
45 |
enum TProfilerKeyEventPropertyKeys
|
|
46 |
{
|
|
47 |
EProfilerKeyEventPropertySample = 7
|
|
48 |
};
|
|
49 |
|
|
50 |
const TUid KGppPropertyCat={0x20201F70};
|
|
51 |
enum TGppPropertyKeys
|
|
52 |
{
|
|
53 |
EGppPropertySyncSampleNumber
|
|
54 |
};
|
|
55 |
|
|
56 |
|
|
57 |
static _LIT_SECURITY_POLICY_PASS(KAllowAllPolicy);
|
|
58 |
static _LIT_SECURITY_POLICY_C1(KCapabilityNone, ECapability_None);
|
|
59 |
|
|
60 |
_LIT(KDllName, "PIProfilerTouchEventAnim.DLL"); // animation server dll on user disk
|
|
61 |
|
|
62 |
/*
|
|
63 |
*
|
|
64 |
* BUP sampler definition
|
|
65 |
*
|
|
66 |
*/
|
|
67 |
class CProfilerButtonListener;
|
|
68 |
class CSamplerPluginInterface;
|
|
69 |
|
|
70 |
class CBupPlugin : public CSamplerPluginInterface
|
62
|
71 |
{
|
51
|
72 |
public:
|
|
73 |
static CBupPlugin* NewL(const TUid aImplementationUid, TAny* aInitParams);
|
|
74 |
~CBupPlugin();
|
|
75 |
|
|
76 |
TInt ResetAndActivateL(CProfilerSampleStream& aStream);
|
|
77 |
TInt StopSampling();
|
|
78 |
TBool Enabled() { return iEnabled; }
|
|
79 |
|
|
80 |
TInt CreateFirstSample();
|
|
81 |
|
|
82 |
// no sub samplers, from CSamplerPluginInterface
|
|
83 |
TInt SubId(TUid /*aId*/) const {return KErrNotFound;}
|
|
84 |
TInt GetSamplerType();
|
|
85 |
|
|
86 |
void GetAttributesL(CArrayFixFlat<TSamplerAttributes>* aAttributes);
|
|
87 |
TInt SetAttributesL(TSamplerAttributes& aAttributes);
|
|
88 |
void InitiateSamplerAttributesL();
|
|
89 |
|
|
90 |
TInt ConvertRawSettingsToAttributes(CDesC8ArrayFlat* aSingleSettingArray);
|
|
91 |
|
|
92 |
TInt DoSetSamplerSettings(CDesC8ArrayFlat* aAllSettings, TDesC8& aSamplerName, TInt aIndex);
|
|
93 |
void SaveSettingToAttributes(const TDesC8& aSetting, TInt aIndex);
|
|
94 |
|
|
95 |
TUid Id(TInt aSubId) const;
|
|
96 |
|
|
97 |
void FillThisStreamBuffer(TBapBuf* nextFree,TRequestStatus& aStatus);
|
|
98 |
|
|
99 |
private:
|
|
100 |
CBupPlugin();
|
|
101 |
void ConstructL();
|
|
102 |
|
|
103 |
private:
|
|
104 |
TUint8 iVersion[20];
|
|
105 |
TPtr8 iVersionDescriptor;
|
|
106 |
|
|
107 |
TInt iSamplerType;
|
|
108 |
|
|
109 |
CProfilerButtonListener* iButtonListener;
|
|
110 |
CArrayFixFlat<TSamplerAttributes>* iSamplerAttributes;
|
|
111 |
public:
|
|
112 |
TUint32* iSampleTime;
|
62
|
113 |
};
|
51
|
114 |
|
|
115 |
/*
|
|
116 |
*
|
|
117 |
* Base class for all windows
|
|
118 |
*
|
|
119 |
*/
|
|
120 |
class CWsClient : public CActive
|
|
121 |
{
|
|
122 |
protected:
|
|
123 |
//construct
|
|
124 |
CWsClient();
|
|
125 |
CWsScreenDevice* iScreen;
|
|
126 |
RWsSession iWs;
|
|
127 |
public:
|
62
|
128 |
void ConstructL(CBupPlugin* aSampler);
|
51
|
129 |
// destruct
|
|
130 |
~CWsClient();
|
|
131 |
// main window
|
|
132 |
virtual void ConstructMainWindowL();
|
|
133 |
void Exit();
|
|
134 |
// active object protocol
|
|
135 |
void IssueRequest(); // request an event
|
|
136 |
void DoCancel(); // cancel the request
|
|
137 |
virtual void RunL() = 0; // handle completed request
|
|
138 |
virtual void HandleKeyEventL (TKeyEvent& aKeyEvent) = 0;
|
62
|
139 |
virtual void HandleEvent(TInt c) = 0;
|
51
|
140 |
RWindowGroup Group() {return iGroup;};
|
62
|
141 |
CBupPlugin* GetSampler();
|
51
|
142 |
private:
|
62
|
143 |
RWindowGroup iGroup;
|
|
144 |
CWindowGc* iGc;
|
|
145 |
friend class CWindow; // needs to get at session
|
|
146 |
RProperty iProperty;
|
|
147 |
CBupPlugin* iSampler;
|
51
|
148 |
};
|
|
149 |
|
|
150 |
/*
|
|
151 |
*
|
|
152 |
* CWindow declaration
|
|
153 |
*
|
|
154 |
*/
|
|
155 |
class CWindow : public CBase
|
|
156 |
{
|
62
|
157 |
protected:
|
|
158 |
RWindow iWindow; // window server window
|
|
159 |
TRect iRect; // rectangle re owning window
|
|
160 |
public:
|
|
161 |
CWindow(CWsClient* aClient);
|
|
162 |
void ConstructL (const TRect& aRect, CWindow* aParent=0);
|
|
163 |
~CWindow();
|
|
164 |
// access
|
|
165 |
RWindow& Window(); // our own window
|
|
166 |
CWindowGc* SystemGc(); // system graphics context
|
|
167 |
// empty drawing functions
|
|
168 |
virtual void Draw(const TRect& aRect) = 0;
|
|
169 |
virtual void HandlePointerEvent (TPointerEvent& aPointerEvent) = 0;
|
|
170 |
|
|
171 |
CWsClient* Client() {return iClient;};
|
|
172 |
private:
|
|
173 |
CWsClient* iClient; // client including session and group
|
51
|
174 |
};
|
|
175 |
|
62
|
176 |
class CMainWindow : public CWindow
|
|
177 |
{
|
|
178 |
public:
|
|
179 |
CMainWindow (CWsClient* aClient);
|
|
180 |
void Draw (const TRect& aRect);
|
|
181 |
~CMainWindow ();
|
|
182 |
void HandlePointerEvent (TPointerEvent& aPointerEvent);
|
|
183 |
void ConstructL (const TRect& aRect, CWindow* aParent=0);
|
|
184 |
};
|
|
185 |
|
|
186 |
class CProfilerButtonListener : public CWsClient
|
|
187 |
{
|
|
188 |
public:
|
|
189 |
CProfilerButtonListener();
|
|
190 |
void ConstructMainWindowL();
|
|
191 |
~CProfilerButtonListener();
|
|
192 |
void RunL();
|
|
193 |
void DoCancel();
|
|
194 |
void HandleKeyEventL (TKeyEvent& aKeyEvent);
|
|
195 |
void HandleEvent(TInt c);
|
|
196 |
private:
|
|
197 |
CMainWindow* iMainWindow; // main window
|
|
198 |
TInt iSampleStartTime;
|
|
199 |
TUint8 iSample[8];
|
|
200 |
RProfilerTouchEventAnim* iAnim;
|
|
201 |
RAnimDll* iAnimDll;
|
|
202 |
};
|
51
|
203 |
|
|
204 |
#endif
|