|
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 |
|
71 { |
|
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; |
|
113 }; |
|
114 |
|
115 |
|
116 /* |
|
117 * |
|
118 * Base class for all windows |
|
119 * |
|
120 */ |
|
121 class CWsClient : public CActive |
|
122 { |
|
123 protected: |
|
124 //construct |
|
125 CWsClient(); |
|
126 CWsScreenDevice* iScreen; |
|
127 RWsSession iWs; |
|
128 public: |
|
129 void ConstructL(); |
|
130 // destruct |
|
131 ~CWsClient(); |
|
132 // main window |
|
133 virtual void ConstructMainWindowL(); |
|
134 // terminate cleanly |
|
135 void Exit(); |
|
136 // active object protocol |
|
137 void IssueRequest(); // request an event |
|
138 void DoCancel(); // cancel the request |
|
139 virtual TInt RunError(TInt aError) = 0; |
|
140 virtual void RunL() = 0; // handle completed request |
|
141 virtual void HandleKeyEventL (TKeyEvent& aKeyEvent) = 0; |
|
142 |
|
143 RWindowGroup Group() {return iGroup;}; |
|
144 |
|
145 private: |
|
146 RWindowGroup iGroup; |
|
147 CWindowGc* iGc; |
|
148 friend class CWindow; // needs to get at session |
|
149 RProperty iProperty; |
|
150 |
|
151 }; |
|
152 |
|
153 |
|
154 |
|
155 class CWindow; |
|
156 |
|
157 class CProfilerButtonListener : public CWsClient |
|
158 { |
|
159 public: |
|
160 static CProfilerButtonListener* NewL(CBupPlugin* aSamplerm); |
|
161 ~CProfilerButtonListener(); |
|
162 private: |
|
163 CProfilerButtonListener(CBupPlugin* aSampler); |
|
164 |
|
165 |
|
166 public: |
|
167 void ConstructMainWindowL(); |
|
168 void HandleKeyEventL (TKeyEvent& aKeyEvent); |
|
169 void RunL(); |
|
170 TInt RunError(TInt aError); |
|
171 TInt StartL(); |
|
172 TInt Stop(); |
|
173 |
|
174 private: |
|
175 TUint8 iSample[8]; |
|
176 |
|
177 CBupPlugin* iSampler; |
|
178 RProfilerTouchEventAnim* iAnim; |
|
179 RAnimDll* iAnimDll; |
|
180 CWindow* iMainWindow; // main window |
|
181 |
|
182 TInt iSampleStartTime; |
|
183 }; |
|
184 |
|
185 |
|
186 |
|
187 /* |
|
188 * |
|
189 * CWindow declaration |
|
190 * |
|
191 */ |
|
192 class CWindow : public CBase |
|
193 { |
|
194 protected: |
|
195 RWindow iWindow; // window server window |
|
196 TRect iRect; // rectangle re owning window |
|
197 public: |
|
198 CWindow(CWsClient* aClient); |
|
199 void ConstructL (const TRect& aRect, CWindow* aParent=0); |
|
200 ~CWindow(); |
|
201 // access |
|
202 RWindow& Window(); // our own window |
|
203 CWindowGc* SystemGc(); // system graphics context |
|
204 |
|
205 CWsClient* Client() {return iClient;}; |
|
206 private: |
|
207 CWsClient* iClient; // client including session and group |
|
208 }; |
|
209 |
|
210 |
|
211 #endif |