|
1 /* |
|
2 * Copyright (c) 2005-2006 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: header file for peninput session |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 #ifndef C_CPENINPUTSESSION_H |
|
22 #define C_CPENINPUTSESSION_H |
|
23 |
|
24 // INCLUDES |
|
25 #include <e32base.h> |
|
26 #include "peninputcmdparam.h" |
|
27 |
|
28 class CPeninputServer; |
|
29 class RMessage2; |
|
30 |
|
31 |
|
32 /** |
|
33 * This class represents a session in the server. |
|
34 * |
|
35 * Functions are provided to respond appropriately to client messages |
|
36 * |
|
37 * @since S60 v4.0 |
|
38 */ |
|
39 NONSHARABLE_CLASS(CPeninputServerSession) : public CSession2 |
|
40 { |
|
41 public: |
|
42 // Constructors and destructor |
|
43 /** |
|
44 * Constructor. |
|
45 * |
|
46 * @since S60 v4.0 |
|
47 * @param aClient reference to client thread |
|
48 * @param aServer pointer to CPeninputServer |
|
49 */ |
|
50 CPeninputServerSession(RThread &aClient, CPeninputServer& aServer); |
|
51 |
|
52 /** |
|
53 * Destructor. |
|
54 * |
|
55 * @since S60 v4.0 |
|
56 */ |
|
57 ~CPeninputServerSession(); |
|
58 |
|
59 /** |
|
60 * Static initializer. |
|
61 * |
|
62 * @since S60 v4.0 |
|
63 * @param aClient reference to client thread |
|
64 * @param aServer pointer to CPeninputServer |
|
65 * @return Sever session created |
|
66 */ |
|
67 static CPeninputServerSession* NewL(RThread &aClient, |
|
68 CPeninputServer& aServer); |
|
69 |
|
70 /** |
|
71 * Signals the client with the given code, if the client has |
|
72 * registered as observer. |
|
73 * |
|
74 * @since S60 v4.0 |
|
75 * @param aSignalCode The event code |
|
76 * @param aEventData The event data |
|
77 * @return ETrue if client was signalled succesfully, EFalse otherwise. |
|
78 */ |
|
79 TBool SignalClientL(TInt aSignalCode,const TDesC& aEventData); |
|
80 |
|
81 /** |
|
82 * Signals the client that UI is activated or deactivaed. |
|
83 * |
|
84 * @since S60 v4.0 |
|
85 * @param aSignalCode The event code |
|
86 * @param aType pen ui type associated with this event |
|
87 * @return ETrue if client was signalled succesfully, EFalse otherwise. |
|
88 */ |
|
89 TBool SignalUiActivationObserver(TInt aSignalCode,TInt aType); |
|
90 |
|
91 |
|
92 /** |
|
93 * Handling pending event before this session is closed. |
|
94 * |
|
95 * @since S60 v4.0 |
|
96 */ |
|
97 void ProcessPendingEventBeforeExit(); |
|
98 |
|
99 /* |
|
100 * Returns id of the application thread that created this session. |
|
101 * |
|
102 * @since S60 v4.0 |
|
103 * @return client thread id |
|
104 */ |
|
105 TInt ClientId(); |
|
106 |
|
107 /** |
|
108 * Increase the delayed command count |
|
109 * |
|
110 * @since S60 v4.0 |
|
111 */ |
|
112 void AddDelayedCmd(); |
|
113 |
|
114 |
|
115 /** |
|
116 * Regiseter the ui type to be monitored. |
|
117 * |
|
118 * @since S60 v4.0 |
|
119 * @aType The ui type to be monitored. |
|
120 */ |
|
121 void RegisterPenUiType(TInt aType); |
|
122 |
|
123 /** |
|
124 * Panic client |
|
125 * |
|
126 * @since S60 v4.0 |
|
127 * @param aMessage The client message |
|
128 * @param aPanic panic code |
|
129 */ |
|
130 static void PanicClient(const RMessage2& aMessage ,TInt aPanic ); |
|
131 |
|
132 // from base classes CSession2 |
|
133 |
|
134 /** |
|
135 * From CSession2. |
|
136 * handle client request |
|
137 * |
|
138 * @since S60 v4.0 |
|
139 * @param aMessage The client request message |
|
140 */ |
|
141 virtual void ServiceL( const RMessage2 &aMessage ); |
|
142 |
|
143 /** |
|
144 * To get disabled layouts for the session of RMessage |
|
145 * |
|
146 * @since S60 v6.0 |
|
147 * @param aDisabledLayouts The disabled mode to set |
|
148 */ |
|
149 const TProcessId& ClientProcessId(); |
|
150 TInt DisabledUiType(); |
|
151 |
|
152 TInt DoUpdateAppInfo(); |
|
153 |
|
154 inline TBool DsaEverHappened() const; |
|
155 private: // New functions |
|
156 /** |
|
157 * 2nd phase constuctor |
|
158 * |
|
159 * @since S60 v4.0 |
|
160 */ |
|
161 void ConstructL(); |
|
162 |
|
163 /** |
|
164 * handle client request |
|
165 * |
|
166 * @since S60 v4.0 |
|
167 * @param aMessage The client request message |
|
168 * @return The operation result code |
|
169 */ |
|
170 TInt DoServiceL( const RMessage2 &aMessage ); |
|
171 |
|
172 |
|
173 /** |
|
174 * Remove the given event data |
|
175 * |
|
176 * @since S60 v4.0 |
|
177 * @param aIndex The event to be remvoed. If aIndex < 0, all events |
|
178 * are removed. |
|
179 */ |
|
180 void RemoveEventDataByIdx(TInt aIndex); |
|
181 |
|
182 /** |
|
183 * Save data and complete the pending request |
|
184 * |
|
185 * @since S60 v4.0 |
|
186 * @param aSignalCode The event code |
|
187 * @param aEventData The event data |
|
188 * @param aPos The event data position. if -1, then append to the end. |
|
189 * @return ETrue if OK. |
|
190 */ |
|
191 TBool CompletePendingRequestL(TInt aSignalCode,const TDesC& aEventData, |
|
192 int aPos = -1); |
|
193 |
|
194 TInt HandleAppInfoChange(const RMessage2& aMessage); |
|
195 TInt HandleAppInfoChangeL(const RMessage2& aMessage); |
|
196 /** |
|
197 * Build the event buf to send to client. |
|
198 * It checks whether we can combine several events data together to send in one round. |
|
199 * |
|
200 * @since S60 v5.0 |
|
201 * @return The number of combined event. -1 if there is no memory to build data buffer. |
|
202 */ |
|
203 TInt BuildEventData(); |
|
204 |
|
205 /** |
|
206 * Remove the given number of event data |
|
207 * |
|
208 * @since S60 v5.0 |
|
209 * @param aNum The number of events to be remvoed. |
|
210 */ |
|
211 void RemoveEventDatas(TInt aNum); |
|
212 |
|
213 /** |
|
214 * Send the event data via the given message. |
|
215 * |
|
216 * @since S60 v5.0 |
|
217 * @return KErrNone if succefully, otherwise returns the length needed for msg buf. |
|
218 */ |
|
219 TInt SendEventData(const RMessage2& aMessage, const TDesC& aData); |
|
220 private: // Data |
|
221 |
|
222 /** |
|
223 * Reference to PENINPUT server |
|
224 */ |
|
225 CPeninputServer& iPenInputSvr; |
|
226 |
|
227 /** |
|
228 * Each client can have one pending request which is issued with function |
|
229 * RequestMessageNotification and is signalled when the client has to switch |
|
230 * FEP or launch help application. Pointer not owned. |
|
231 */ |
|
232 RMessage2 iPendingRequest; |
|
233 |
|
234 /** |
|
235 * Flag to indicate whether client has issued a notification request. |
|
236 */ |
|
237 TBool iObserverActive; |
|
238 |
|
239 /** |
|
240 * Id of the client thread for debugging purposes |
|
241 */ |
|
242 TInt iClientId; |
|
243 |
|
244 /** |
|
245 * Delayed command count for this session |
|
246 */ |
|
247 TInt iDelayedCmd; |
|
248 |
|
249 /** |
|
250 * The pen ui type to be monitored |
|
251 */ |
|
252 TInt iRegistedPenUiType; |
|
253 |
|
254 /** |
|
255 * event code array |
|
256 */ |
|
257 RArray<TInt> iSignalCodeArray; |
|
258 |
|
259 /** |
|
260 * session data buffer |
|
261 * Own |
|
262 */ |
|
263 RPointerArray<HBufC> iDataBuf; |
|
264 |
|
265 RBuf iCombinedEventBuf; |
|
266 TInt iCombinedMsgNum; |
|
267 |
|
268 TInt iCombinedEventId; |
|
269 |
|
270 TProcessId iClientProcess; |
|
271 |
|
272 HBufC* iAppInfo; |
|
273 |
|
274 TPeninputAppInfo iAppInfoType; |
|
275 TInt iDisabledUiType; |
|
276 TBool iDsaEverHappened; |
|
277 }; |
|
278 #endif //C_CPENINPUTSESSION_H |
|
279 |
|
280 inline TBool CPeninputServerSession::DsaEverHappened() const |
|
281 { |
|
282 return iDsaEverHappened; |
|
283 } |
|
284 // End of File |