0
|
1 |
/*------------------------------------------------------------------
|
|
2 |
-
|
|
3 |
* Software Name : UserEmulator
|
|
4 |
* Version : v4.2.1309
|
|
5 |
*
|
|
6 |
* Copyright (c) 2009 France Telecom. All rights reserved.
|
|
7 |
* This software is distributed under the License
|
|
8 |
* "Eclipse Public License - v 1.0" the text of which is available
|
|
9 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
10 |
*
|
|
11 |
* Initial Contributors:
|
|
12 |
* France Telecom
|
|
13 |
*
|
|
14 |
* Contributors:
|
|
15 |
*------------------------------------------------------------------
|
|
16 |
-
|
|
17 |
* File Name: GlobalCapturer.h
|
|
18 |
*
|
|
19 |
* Created: 13/08/2009
|
|
20 |
* Author(s): Marcell Kiss, Reshma Sandeep Das
|
|
21 |
*
|
|
22 |
* Description:
|
|
23 |
* Key capturing class
|
|
24 |
*------------------------------------------------------------------
|
|
25 |
-
|
|
26 |
*
|
|
27 |
*/
|
|
28 |
|
|
29 |
#ifndef GLOBALKEYCAPTURE_H__
|
|
30 |
#define GLOBALKEYCAPTURE_H__
|
|
31 |
|
|
32 |
// System Includes
|
|
33 |
#include <e32base.h>
|
|
34 |
#include <w32std.h>
|
|
35 |
#include <aknglobalnote.h>
|
|
36 |
#include <COECNTRL.H>
|
|
37 |
// User Includes
|
|
38 |
#include "Settings.h"
|
|
39 |
#include "clientcommander.h"
|
|
40 |
#include "CameraAppTimer.h"
|
|
41 |
#include "Constants.h"
|
|
42 |
|
|
43 |
// Forward declarations
|
|
44 |
class RWindowGroup;
|
|
45 |
class CApaWindowGroupName;
|
|
46 |
|
|
47 |
// Class Declarations
|
|
48 |
/**
|
|
49 |
* Key observer interface class
|
|
50 |
*/
|
|
51 |
class MKeyObserver
|
|
52 |
{
|
|
53 |
public:
|
|
54 |
/**
|
|
55 |
* Callback to handle Power key button press and stops scripts
|
|
56 |
*/
|
|
57 |
virtual void TerminationKeyReceived() = 0;
|
|
58 |
/**
|
|
59 |
* Callback to notify AppUi to bring app to foreground
|
|
60 |
*/
|
|
61 |
virtual void BringUserEmulatorToFront() = 0;
|
|
62 |
/**
|
|
63 |
* Stops random test by this callback function
|
|
64 |
*/
|
|
65 |
virtual void RandomTestEndsL() = 0;
|
|
66 |
};
|
|
67 |
|
|
68 |
/**
|
|
69 |
* Registers itself for event capturing.
|
|
70 |
* Is notified about events via CActive calls
|
|
71 |
*/
|
|
72 |
class CGlobalCapturer : public CActive, public MCameraAppObserver
|
|
73 |
{
|
|
74 |
public:
|
|
75 |
/**
|
|
76 |
* Static constructor
|
|
77 |
* @param aObserver Reference key press observer
|
|
78 |
* @param aSettings Reference to Setting class
|
|
79 |
* @param aScriptRun Reference to script run flag from AppUi
|
|
80 |
* @param aRandomTestStarted Reference to random test started flag from AppUi
|
|
81 |
* @param aClientCommander Reference to client commander client side object
|
|
82 |
* @param aEikonEnv Reference to controls environment
|
|
83 |
* @param aSession Reference to session with the application architecture server.
|
|
84 |
* @return CGlobalCapturer* A pointer to the newly allocated CGlobalCapturer class.
|
|
85 |
* NULL, if the class cannot be created
|
|
86 |
*/
|
|
87 |
static CGlobalCapturer* NewL(MKeyObserver& aObserver, CSettings& aSettings, TBool& aScriptRun,
|
|
88 |
TBool& aRandomTestStarted, RClientCommander& aClientCommander, CEikonEnv* aEikonEnv,RApaLsSession& aSession);
|
|
89 |
|
|
90 |
/**
|
|
91 |
* Destructor
|
|
92 |
*/
|
|
93 |
~CGlobalCapturer();
|
|
94 |
|
|
95 |
/**
|
|
96 |
* Registers itself for the key press event
|
|
97 |
*/
|
|
98 |
void StartCapturingL();
|
|
99 |
|
|
100 |
/**
|
|
101 |
* Starts capturing Power button
|
|
102 |
*/
|
|
103 |
void StartL();
|
|
104 |
/**
|
|
105 |
* Stops capturing Power button
|
|
106 |
*/
|
|
107 |
void Stop();
|
|
108 |
/**
|
|
109 |
* Stops capturing keys (in Window server)
|
|
110 |
*/
|
|
111 |
void StopRecordKeysL();
|
|
112 |
/**
|
|
113 |
* Starts capturing keys by Window server
|
|
114 |
*/
|
|
115 |
TInt StartRecordKeysL();
|
|
116 |
/**
|
|
117 |
* Checks if camera app is in memory or not
|
|
118 |
*/
|
|
119 |
void CheckCameraAppL();
|
|
120 |
/**
|
|
121 |
* Resets Menu screen and (Home screen's) idle screen
|
|
122 |
*/
|
|
123 |
TInt ScreenReset();
|
|
124 |
/**
|
|
125 |
* Kill apps (with exceptions)
|
|
126 |
*/
|
|
127 |
void KillUnwantedAppsResetL();
|
|
128 |
|
|
129 |
private: //From CActive
|
|
130 |
/**
|
|
131 |
* Is called by active scheduler when key press happens
|
|
132 |
*/
|
|
133 |
void RunL();
|
|
134 |
|
|
135 |
/**
|
|
136 |
* Is called when event listening should be stopped
|
|
137 |
*/
|
|
138 |
virtual void DoCancel();
|
|
139 |
|
|
140 |
private:
|
|
141 |
/**
|
|
142 |
* Constructor
|
|
143 |
* @param aObserver Reference key press observer
|
|
144 |
* @param aSettings Reference to Setting class
|
|
145 |
* @param aScriptRun Reference to script run flag from AppUi
|
|
146 |
* @param aRandomTestStarted Reference to random test started flag from AppUi
|
|
147 |
* @param aClientCommander Reference to client commander client side object
|
|
148 |
* @param aEikonEnv Reference to controls environment
|
|
149 |
* @param aSession Reference to session with the application architecture server
|
|
150 |
*/
|
|
151 |
CGlobalCapturer(MKeyObserver& aObserver, CSettings& aSettings, TBool& aScriptRun, TBool& aRandomTestStarted,
|
|
152 |
RClientCommander& aClientCommander, CEikonEnv* aEikonEnv,RApaLsSession& aSession);
|
|
153 |
|
|
154 |
/**
|
|
155 |
* Second phase constructor
|
|
156 |
*/
|
|
157 |
void ConstructL();
|
|
158 |
|
|
159 |
/**
|
|
160 |
* Filters characters which shouldn't be in a file name
|
|
161 |
*/
|
|
162 |
TBool StrictFileNameCheck(const TDesC& aFileName);
|
|
163 |
|
|
164 |
public:
|
|
165 |
/**
|
|
166 |
* Flag. True if recording is running
|
|
167 |
*/
|
|
168 |
TBool iRecord;
|
|
169 |
|
|
170 |
private:
|
|
171 |
/**
|
|
172 |
* Handler to Power button
|
|
173 |
*/
|
|
174 |
TInt32 iCaptureHandle1;
|
|
175 |
/**
|
|
176 |
* Session to the window server
|
|
177 |
*/
|
|
178 |
RWsSession iWsSession;
|
|
179 |
/**
|
|
180 |
* Window group object
|
|
181 |
*/
|
|
182 |
RWindowGroup* iWindowGroup;
|
|
183 |
/**
|
|
184 |
* Key event details structure
|
|
185 |
*/
|
|
186 |
TKeyEvent* iKeyEvent;
|
|
187 |
/**
|
|
188 |
* Handle to the capturing request
|
|
189 |
*/
|
|
190 |
MKeyObserver& iObserver;
|
|
191 |
/**
|
|
192 |
* Reference to settings
|
|
193 |
*/
|
|
194 |
CSettings& iSettings;
|
|
195 |
/**
|
|
196 |
* A handle to a file server session
|
|
197 |
*/
|
|
198 |
RFs iFs;
|
|
199 |
/**
|
|
200 |
* Reference to script run flag
|
|
201 |
*/
|
|
202 |
TBool& iScriptRun;
|
|
203 |
/**
|
|
204 |
* Reference to randomtest started flag
|
|
205 |
*/
|
|
206 |
TBool& iRandomTestStarted;
|
|
207 |
/**
|
|
208 |
* Flag. True if key capturing started
|
|
209 |
*/
|
|
210 |
TBool iKeyCaptureStart;
|
|
211 |
/**
|
|
212 |
* Reference to client commander object
|
|
213 |
*/
|
|
214 |
RClientCommander& iClientCommander;
|
|
215 |
/**
|
|
216 |
* Buffer for script name and path
|
|
217 |
*/
|
|
218 |
TBuf8<512> iBuf8;
|
|
219 |
/**
|
|
220 |
* Reference to controls environment
|
|
221 |
*/
|
|
222 |
CEikonEnv* iEEnv;
|
|
223 |
/**
|
|
224 |
* Reference to camera timer
|
|
225 |
*/
|
|
226 |
CCameraAppTimer* iCameraAppTimer;
|
|
227 |
/**
|
|
228 |
* Buffer for app's name which are in foreground.
|
|
229 |
*/
|
|
230 |
TBuf8<512> iAppName;
|
|
231 |
/**
|
|
232 |
* Reference to session with the application architecture server
|
|
233 |
*
|
|
234 |
*/
|
|
235 |
RApaLsSession& iSession;
|
|
236 |
};
|
|
237 |
|
|
238 |
#endif // GLOBALKEYCAPTURE_H__
|