|
1 /* |
|
2 * Copyright (c) 2007 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: Active object for watching P&S changes |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef CSVPPROPERTYWATCH_H |
|
21 #define CSVPPROPERTYWATCH_H |
|
22 |
|
23 #include <e32base.h> |
|
24 #include <e32property.h> |
|
25 |
|
26 #include "svppropertywatchobserver.h" |
|
27 #include "svputdefs.h" |
|
28 |
|
29 /** |
|
30 * Attaches itself to the specified P&S property and notifies clients when |
|
31 * property was changed. |
|
32 * |
|
33 * |
|
34 * @lib svp.dll |
|
35 * @since S60 3.2 |
|
36 */ |
|
37 class CSVPPropertyWatch : public CActive |
|
38 { |
|
39 |
|
40 public: |
|
41 |
|
42 /** |
|
43 * Two-phased constructor. |
|
44 */ |
|
45 static CSVPPropertyWatch* NewL( MSVPPropertyWatchObserver& aClient, |
|
46 const TUid& aCategory, |
|
47 TInt aKey ); |
|
48 |
|
49 /** |
|
50 * Destructor. |
|
51 */ |
|
52 virtual ~CSVPPropertyWatch(); |
|
53 |
|
54 protected: // Functions from base classes |
|
55 |
|
56 /** |
|
57 * From CActive. Handles an active object's request completion event. |
|
58 */ |
|
59 void RunL(); |
|
60 |
|
61 /** |
|
62 * From CActive. Implements cancellation of an outstanding request. |
|
63 */ |
|
64 void DoCancel(); |
|
65 |
|
66 /** |
|
67 * From CActive. Handles a leave occurring in the request completion |
|
68 * event handler RunL(). |
|
69 */ |
|
70 TInt RunError( TInt aError ); |
|
71 |
|
72 private: |
|
73 |
|
74 /** |
|
75 * C++ default constructor. |
|
76 */ |
|
77 CSVPPropertyWatch( MSVPPropertyWatchObserver& aClient, TInt aKey ); |
|
78 |
|
79 /** |
|
80 * By default Symbian 2nd phase constructor is private. |
|
81 */ |
|
82 void ConstructL( const TUid& aCategory ); |
|
83 |
|
84 |
|
85 private: // Data |
|
86 |
|
87 /** |
|
88 * The client interested being notified about property changes |
|
89 */ |
|
90 MSVPPropertyWatchObserver& iClient; |
|
91 |
|
92 /** |
|
93 * The key defining property where watcher attaches to |
|
94 */ |
|
95 TInt iKey; |
|
96 |
|
97 /** |
|
98 * The property to attach to |
|
99 */ |
|
100 RProperty iProperty; |
|
101 |
|
102 private: |
|
103 |
|
104 // For testing |
|
105 SVP_UT_DEFS |
|
106 |
|
107 }; |
|
108 |
|
109 #endif // C_SVPPROPERTYWATCH_H |