|
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: Class for monitoring changes in P&S keys. |
|
15 * Part of: Tactile Feedback. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #ifndef TACTILEPROPERTYWATCHER_H |
|
21 #define TACTILEPROPERTYWATCHER_H |
|
22 |
|
23 |
|
24 #include <e32base.h> |
|
25 #include <e32std.h> |
|
26 #include <e32property.h> |
|
27 |
|
28 #include "tactilepropertyobserver.h" |
|
29 |
|
30 |
|
31 |
|
32 /** |
|
33 * Observer class for accessing to P&S property values, and listening |
|
34 * to changes. |
|
35 * |
|
36 * @lib tactilefeedbackresolver.lib |
|
37 * @since S60 v5.0 |
|
38 */ |
|
39 NONSHARABLE_CLASS( CTactilePropertyWatcher ): public CActive |
|
40 { |
|
41 public: |
|
42 |
|
43 /** |
|
44 * Intantiation method. |
|
45 * |
|
46 * This will create a property wather active |
|
47 * object with given active object priority. |
|
48 * |
|
49 * @param aObserver - Reference to observer interface. |
|
50 * @param aCategory - P&S category, where the observed key is. |
|
51 * @param aKey - Observed P&S key. |
|
52 * @param aPriority - Active object priority, which is given to |
|
53 * this wather instance. |
|
54 * @return New property watcher instance. |
|
55 */ |
|
56 static CTactilePropertyWatcher* NewL( |
|
57 MTactilePropertyObserver& aObserver, |
|
58 const TUid aCategory, |
|
59 const TInt aKey, |
|
60 CActive::TPriority aPriority ); |
|
61 |
|
62 ~CTactilePropertyWatcher(); |
|
63 |
|
64 |
|
65 /** |
|
66 * Retrieves an integer value associated with this property. |
|
67 * |
|
68 * Leaves with Standard Symbian OS error codes in case |
|
69 * retreving of the value fails. |
|
70 * |
|
71 * @param aValue - The property value is returned here |
|
72 */ |
|
73 void GetL( TInt& aValue ); |
|
74 |
|
75 /** |
|
76 * Fills aValue with the buffer associated with this property. |
|
77 * |
|
78 * Leaves with Standard Symbian OS error codes in case |
|
79 * retreving of the value fails. |
|
80 * |
|
81 * @param aValue - The property value is returned here |
|
82 */ |
|
83 void GetL( TDes8& aValue ); |
|
84 |
|
85 /** |
|
86 * Retrieves an integer value associated with this property. |
|
87 * |
|
88 * Does not leave in case reading of the property fails, but |
|
89 * instead returns Standard Symbian OS error code. |
|
90 * |
|
91 * @param aValue the property value is returned here |
|
92 * @return standard Symbian OS error code |
|
93 */ |
|
94 TInt Get( TInt& aValue ); |
|
95 |
|
96 /** |
|
97 * Fills aValue with the buffer associated with this property. |
|
98 * |
|
99 * Does not leave in case reading of the property fails, but |
|
100 * instead returns Standard Symbian OS error code. |
|
101 * |
|
102 * @param aValue the property value is returned here |
|
103 * @return standard Symbian OS error code |
|
104 */ |
|
105 TInt Get( TDes8& aValue ); |
|
106 |
|
107 /** |
|
108 * Sets a P&S property to an integer value. The property must be |
|
109 * already defined. |
|
110 * |
|
111 * @param aValue - The integer value to set to the property |
|
112 */ |
|
113 void SetL( const TInt aValue ); |
|
114 |
|
115 |
|
116 /** |
|
117 * Sets a P&S property to a (large) bytearray value. The property |
|
118 * must be already defined. |
|
119 * |
|
120 * @param aValue - The integer value to set to the property |
|
121 */ |
|
122 void SetL( const TDesC8& aValue ); |
|
123 |
|
124 private: |
|
125 |
|
126 CTactilePropertyWatcher( |
|
127 MTactilePropertyObserver& aObserver, |
|
128 const TUid aCategory, |
|
129 const TInt aKey, |
|
130 CActive::TPriority aPriority ); |
|
131 |
|
132 void ConstructL(); |
|
133 |
|
134 void Subscribe(); |
|
135 |
|
136 |
|
137 // from base class CActive |
|
138 |
|
139 /** |
|
140 * Standard DoCancel of an active object. |
|
141 */ |
|
142 void DoCancel(); |
|
143 |
|
144 /** |
|
145 * Standard RunL of an active object. |
|
146 */ |
|
147 void RunL(); |
|
148 |
|
149 private: // data |
|
150 |
|
151 /** |
|
152 * Access to observer interface |
|
153 * Not own. |
|
154 */ |
|
155 MTactilePropertyObserver& iObserver; |
|
156 |
|
157 /** |
|
158 * The UID of this property |
|
159 */ |
|
160 TUid iCategory; |
|
161 |
|
162 /** |
|
163 * The key of this property |
|
164 */ |
|
165 TUint iKey; |
|
166 |
|
167 /** |
|
168 * Handle to the attached property |
|
169 * Own. |
|
170 */ |
|
171 RProperty iProperty; |
|
172 }; |
|
173 |
|
174 |
|
175 #endif // TACTILEPROPERTYWATCHER_H |
|
176 |
|
177 // End of File |
|
178 |