|
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 the License "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: describes system information notifiers. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef __ACTIVEREQUESTS_H__ |
|
20 #define __ACTIVEREQUESTS_H__ |
|
21 |
|
22 //INCLUDES |
|
23 #include <e32property.h> |
|
24 #include "sysinfo.h" |
|
25 #include "sysrequest.h" |
|
26 |
|
27 // CONSTANT DECLARATIONS |
|
28 |
|
29 // FORWARD DECLARATIONS |
|
30 class CRepository; |
|
31 |
|
32 /** |
|
33 * @ref CActiveRequest base class to be extended for implementing asynchronous requests. |
|
34 * static member function CreateActiveRequestL() is a factory method to create CActiveRequest |
|
35 * object to handle specified asynchronous operation. |
|
36 * |
|
37 * @lib sysinfoservice.lib |
|
38 * @since S60 3.2 |
|
39 */ |
|
40 NONSHARABLE_CLASS(CActiveRequest) : public CActive |
|
41 { |
|
42 public: |
|
43 /** |
|
44 * Issues asynchronous request. funtionality need to provided by implementing class. |
|
45 */ |
|
46 virtual TInt Request() = 0; |
|
47 /** |
|
48 * @return Transaction ID associated with the asynchronous request. |
|
49 */ |
|
50 inline TInt32 TransactionID() const; |
|
51 /** |
|
52 * @return type of request this object handling. |
|
53 */ |
|
54 inline TSysRequest::TRequestType RequestType() const; |
|
55 /** |
|
56 * Destructor. |
|
57 */ |
|
58 ~CActiveRequest(); |
|
59 |
|
60 public: |
|
61 /** |
|
62 * This is an factory method to create asynchronous request based on request |
|
63 * specified in aSysRequest. |
|
64 * |
|
65 * @param aSysRequest Input request consists of SA, Type of request, TID |
|
66 * and SystemData if any. |
|
67 * |
|
68 * @param aActiveObj On return aActiveObj consists of active object that will |
|
69 * handle requested asynchronus operation. |
|
70 * |
|
71 * @error @p KErrNotFound If requested SA not found. |
|
72 * @p KErrNotSupported If specified requeust type doesn't qualify with |
|
73 * requested SA specification. |
|
74 * @p KErrArgument if specified input SystemData doesn't comply |
|
75 * system attribute specification. |
|
76 */ |
|
77 static void CreateActiveRequestL( const TSysRequest& aSysRequest, |
|
78 CActiveRequest*& aActiveObj ); |
|
79 |
|
80 protected: |
|
81 /** |
|
82 * C++ default constructor. |
|
83 */ |
|
84 CActiveRequest(TSysRequest::TRequestType aReqType,TInt32 aTransID, |
|
85 ISystemObserver* aObsrvr); |
|
86 /** |
|
87 * returns observer. |
|
88 */ |
|
89 inline ISystemObserver* SystemObserver(); |
|
90 |
|
91 /** |
|
92 * This function creates active objects that handles network related |
|
93 * system attributes. |
|
94 * |
|
95 * @param aSysRequest Input request consists of SA, Type of request, TID |
|
96 * and SystemData if any. |
|
97 * |
|
98 * @param aActiveObj On return aActiveObj consists of active object that will |
|
99 * handle requested asynchronus operation. |
|
100 * |
|
101 * @error @p KErrNotSupported If specified requeust type doesn't qualify with |
|
102 * requested SA specification. |
|
103 * @p KErrArgument if specified input SystemData doesn't comply |
|
104 * system attribute specification. |
|
105 */ |
|
106 static void CreateNetworkRequestL(const TSysRequest& aSysRequest, |
|
107 CActiveRequest*& aActiveObj); |
|
108 |
|
109 /** |
|
110 * This function creates active objects that handles General Entity related |
|
111 * system attributes. |
|
112 * |
|
113 * @param aSysRequest Input request consists of SA, Type of request, TID |
|
114 * and SystemData if any. |
|
115 * |
|
116 * @param aActiveObj On return aActiveObj consists of active object that will |
|
117 * handle requested asynchronus operation. |
|
118 * |
|
119 * @error @p KErrNotSupported If specified requeust type doesn't qualify with |
|
120 * requested SA specification. |
|
121 * @p KErrArgument if specified input SystemData doesn't comply |
|
122 * system attribute specification. |
|
123 */ |
|
124 static void CreateGeneralRequestL(const TSysRequest& aSysRequest, |
|
125 CActiveRequest*& aActiveObj); |
|
126 |
|
127 /** |
|
128 * This function creates active objects that handles Display Entity related |
|
129 * system attributes. |
|
130 * |
|
131 * @param aSysRequest Input request consists of SA, Type of request, TID |
|
132 * and SystemData if any. |
|
133 * |
|
134 * @param aActiveObj On return aActiveObj consists of active object that will |
|
135 * handle requested asynchronus operation. |
|
136 * |
|
137 * @error @p KErrNotSupported If specified requeust type doesn't qualify with |
|
138 * requested SA specification. |
|
139 * @p KErrArgument if specified input SystemData doesn't comply |
|
140 * system attribute specification. |
|
141 */ |
|
142 static void CreateDisplayRequestL(const TSysRequest& aSysRequest, |
|
143 CActiveRequest*& aActiveObj); |
|
144 |
|
145 private: |
|
146 // Transaction ID |
|
147 TInt32 iTransactionID; |
|
148 |
|
149 // Request Type. |
|
150 TSysRequest::TRequestType iRequestType; |
|
151 // |
|
152 ISystemObserver* iObserver; |
|
153 }; |
|
154 |
|
155 #include "activerequest.inl" |
|
156 |
|
157 /** |
|
158 * @ref ActiveStore This class maintains pointer reference of all ongoing |
|
159 * active requests. Offers funtionality to add or remove an active |
|
160 * request to/from the list. An active object request is identified by this |
|
161 * unique Transaction ID. |
|
162 * |
|
163 * @lib sysinfoservice.lib |
|
164 * @since S60 3.2 |
|
165 */ |
|
166 class ActiveStore |
|
167 { |
|
168 public: |
|
169 /** |
|
170 * This function appends a new active request to the active store. |
|
171 * |
|
172 * @param aActiveReq Input active request to be appended. |
|
173 * |
|
174 * @error @p KErrAlreadyExists |
|
175 * if Transaction ID specified already exists. |
|
176 */ |
|
177 static void AddRequestL(const CActiveRequest* aActiveReq); |
|
178 /** |
|
179 * This function removes an active request in active store. |
|
180 * |
|
181 * @param aActiveReq Input active request to be appended. |
|
182 * |
|
183 * @return @p KErrNone on success. |
|
184 * @p KErrNotFound if specified transaction id doesn't exists. |
|
185 * |
|
186 */ |
|
187 static TInt RemoveRequest(TInt32 aTransID); |
|
188 |
|
189 private: |
|
190 /** |
|
191 * This function releases or removes all requests stored. |
|
192 */ |
|
193 static void ReleaseResources(); |
|
194 |
|
195 private: |
|
196 //pointer array of active requests. |
|
197 static RPointerArray<CActiveRequest> iHandlers; |
|
198 |
|
199 friend class CSysInfoService; |
|
200 }; |
|
201 |
|
202 /** |
|
203 * @ref CCenrepNotifier active object class to handle asynchronous notifications |
|
204 * of central repository key value changes. |
|
205 * |
|
206 * @lib sysinfoservice.lib |
|
207 * @since 3.2 |
|
208 */ |
|
209 NONSHARABLE_CLASS(CCenrepNotifier): public CActiveRequest |
|
210 { |
|
211 public: // Constructors and destructor |
|
212 |
|
213 // Enumeration of supported commands by CCenrepNotifier. |
|
214 enum TCommand { |
|
215 EPridictiveText, |
|
216 EInputLanguage, |
|
217 EBlueTooth, |
|
218 EVibra, |
|
219 EKeyLock, |
|
220 }; |
|
221 |
|
222 public: |
|
223 /** |
|
224 * Two-phased constructor. |
|
225 * |
|
226 * @return A new instance of this class. |
|
227 */ |
|
228 static CCenrepNotifier* NewL( const TSysRequest& aRequest, |
|
229 TCommand aCommand); |
|
230 /** |
|
231 * Destructor. |
|
232 */ |
|
233 ~CCenrepNotifier(); |
|
234 |
|
235 private: |
|
236 /** |
|
237 * C++ default constructor. |
|
238 */ |
|
239 CCenrepNotifier(TSysRequest::TRequestType aReqType, TInt32 aTransID, |
|
240 TCommand aCommand, ISystemObserver* aObsrver); |
|
241 |
|
242 /** |
|
243 * By default Symbian 2nd phase constructor is private. |
|
244 */ |
|
245 void ConstructL(const TSysRequest& aRequest); |
|
246 |
|
247 public: |
|
248 /** |
|
249 * Issues notification request. |
|
250 */ |
|
251 TInt Request(); |
|
252 |
|
253 protected: // from CActive |
|
254 |
|
255 void RunL(); |
|
256 |
|
257 void DoCancel(); |
|
258 |
|
259 private: // DATA |
|
260 /** |
|
261 * Local copy of Entity. |
|
262 */ |
|
263 HBufC* iEntity; |
|
264 |
|
265 /** |
|
266 * Local copy of Key. |
|
267 */ |
|
268 HBufC* iKey; |
|
269 |
|
270 /** |
|
271 * Handle to repository. |
|
272 */ |
|
273 CRepository* iCenrep; |
|
274 |
|
275 /** |
|
276 * Repository UID |
|
277 */ |
|
278 TUid iRepositoryUid; |
|
279 |
|
280 /** |
|
281 * Repository KEY |
|
282 */ |
|
283 TUint iRepositoryKey; |
|
284 |
|
285 /** |
|
286 * Repository KEY |
|
287 */ |
|
288 TInt iValue; |
|
289 |
|
290 /** |
|
291 * Supported command |
|
292 */ |
|
293 TCommand iCommand; |
|
294 }; |
|
295 |
|
296 /** |
|
297 * @ref CPubSubNotifier active object class to handle publish & subscribe key value |
|
298 * changes. |
|
299 * @lib sysinfoservice.lib |
|
300 * @since 3.2 |
|
301 */ |
|
302 NONSHARABLE_CLASS(CPubSubNotifier): public CActiveRequest |
|
303 { |
|
304 public: // Constructors and destructor |
|
305 |
|
306 // Enumeration of supported commands by CPubSubNotifier. |
|
307 enum TCommand |
|
308 { |
|
309 ERegistrationStatus, |
|
310 ENetworkMode, |
|
311 EChargingStatus, |
|
312 EFlipStatus, |
|
313 EGripStatus, |
|
314 EInfraRed, |
|
315 EMemoryCard |
|
316 }; |
|
317 |
|
318 public: |
|
319 /** |
|
320 * Two-phased constructor. |
|
321 * |
|
322 * @return A new instance of this class. |
|
323 */ |
|
324 static CPubSubNotifier* NewL(const TSysRequest& aRequest, TCommand aCommand); |
|
325 /** |
|
326 * Destructor. |
|
327 */ |
|
328 ~CPubSubNotifier(); |
|
329 |
|
330 private: |
|
331 |
|
332 /** |
|
333 * C++ default constructor. |
|
334 */ |
|
335 CPubSubNotifier( TSysRequest::TRequestType aReqType, TInt32 aTransID, |
|
336 TCommand aCommand, ISystemObserver* aObsrver); |
|
337 |
|
338 /** |
|
339 * By default Symbian 2nd phase constructor is private. |
|
340 */ |
|
341 void ConstructL( const TSysRequest& aRequest); |
|
342 |
|
343 public: |
|
344 /** |
|
345 * Issues notification request. |
|
346 */ |
|
347 TInt Request(); |
|
348 |
|
349 protected: // from CActive |
|
350 |
|
351 void RunL(); |
|
352 |
|
353 void DoCancel(); |
|
354 |
|
355 private: // DATA |
|
356 /** |
|
357 * Local copy of Entity. |
|
358 */ |
|
359 HBufC* iEntity; |
|
360 |
|
361 /** |
|
362 * Local copy of Key. |
|
363 */ |
|
364 HBufC* iKey; |
|
365 |
|
366 /** |
|
367 * RProperty handle. |
|
368 */ |
|
369 RProperty iProperty; |
|
370 |
|
371 /** |
|
372 * RProperty category UID. |
|
373 */ |
|
374 TUid iPropertyUid; |
|
375 |
|
376 /** |
|
377 * RProperty KEY of any category. |
|
378 */ |
|
379 TUint iPropertyKey; |
|
380 |
|
381 /** |
|
382 * RProperty category,KEY value. |
|
383 */ |
|
384 TInt iValue; |
|
385 |
|
386 /** |
|
387 * CPubSubNotifier supported input command. |
|
388 */ |
|
389 TCommand iCommand; |
|
390 }; |
|
391 |
|
392 /** |
|
393 * @ref CCriticalMemNotifier active object class to handle critical memory |
|
394 * notifications of drive. |
|
395 * @lib sysinfoservice.lib |
|
396 * @since 3.2 |
|
397 */ |
|
398 |
|
399 NONSHARABLE_CLASS(CCriticalMemNotifier): public CActiveRequest |
|
400 { |
|
401 public: // Constructors and destructor |
|
402 |
|
403 /** |
|
404 * Two-phased constructor. |
|
405 * |
|
406 * @return A new instance of this class. |
|
407 */ |
|
408 static CCriticalMemNotifier* NewL(const TSysRequest& aRequest); |
|
409 |
|
410 /** |
|
411 * Destructor. |
|
412 */ |
|
413 ~CCriticalMemNotifier(); |
|
414 |
|
415 private: |
|
416 |
|
417 /** |
|
418 * C++ default constructor. |
|
419 */ |
|
420 CCriticalMemNotifier(TSysRequest::TRequestType aReqType, TInt32 aTransID, |
|
421 ISystemObserver* aObsrver); |
|
422 |
|
423 /** |
|
424 * By default Symbian 2nd phase constructor is private. |
|
425 */ |
|
426 void ConstructL(const TSysRequest& aRequest); |
|
427 |
|
428 public: |
|
429 |
|
430 TInt Request(); |
|
431 |
|
432 protected: // from CActive |
|
433 |
|
434 void RunL(); |
|
435 |
|
436 void DoCancel(); |
|
437 |
|
438 private: // DATA |
|
439 |
|
440 /** |
|
441 * Session handle to file server. |
|
442 */ |
|
443 RFs iFs; |
|
444 |
|
445 /** |
|
446 * Drive number |
|
447 */ |
|
448 TInt iDrvNumber; |
|
449 |
|
450 /** |
|
451 * Critical memory associcated with the drive. |
|
452 */ |
|
453 TInt iCriticalFreeMemory; |
|
454 }; |
|
455 |
|
456 |
|
457 #endif __ACTIVE_REQUESTS_H__ |