|
1 /* |
|
2 * Copyright (c) 2006-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: An observer and I/F class to observe Publish and Subscribe key changes. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef CPROPERTYOBSERVER_H |
|
21 #define CPROPERTYOBSERVER_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <e32base.h> |
|
25 #include <e32property.h> |
|
26 |
|
27 // CLASS DECLARATION |
|
28 |
|
29 /** |
|
30 * MPropertyChangeHandler. |
|
31 * Abstract interface for handling property change events. |
|
32 **/ |
|
33 |
|
34 NONSHARABLE_CLASS( MPropertyChangeHandler ) |
|
35 { |
|
36 public: |
|
37 /** |
|
38 * This is a callback function which is called when a property is changed. |
|
39 * |
|
40 * @param aCategory UID of the category. |
|
41 * @param aKey changed key |
|
42 * @param aValue the new value |
|
43 * |
|
44 * Note! references aKey and aValue are only valid while executing |
|
45 * HandlePropertyChange(). After that the data in which they refer can change. |
|
46 **/ |
|
47 virtual void HandlePropertyChange(const TUid aCategory, const TUint aKey, const TInt aValue) = 0; |
|
48 |
|
49 }; |
|
50 |
|
51 // INCLUDES |
|
52 |
|
53 // CONSTANTS |
|
54 |
|
55 // CLASS DECLARATION |
|
56 |
|
57 /** |
|
58 * ?one_line_short_description. |
|
59 * ?other_description_lines |
|
60 * |
|
61 * @lib AknAlarmService |
|
62 * @since Series 60 2.8 |
|
63 **/ |
|
64 NONSHARABLE_CLASS(CPropertyObserver) : public CActive |
|
65 { |
|
66 public: // Constructors and destructor |
|
67 /** |
|
68 * Two-phased constructor. |
|
69 * @since Series 60 2.8 |
|
70 * @param ?arg1 ?description |
|
71 * @param ?arg2 ?description |
|
72 **/ |
|
73 static CPropertyObserver* NewL(MPropertyChangeHandler& aHandler, TUid aCategory, TUint aKey); |
|
74 |
|
75 /** |
|
76 * Destructor. |
|
77 **/ |
|
78 ~CPropertyObserver(); |
|
79 |
|
80 private: |
|
81 /** |
|
82 * C++ default constructor overload. |
|
83 **/ |
|
84 CPropertyObserver(MPropertyChangeHandler& aHandler, TUid aCategory, TUint aKey); |
|
85 |
|
86 /** |
|
87 * By default Symbian 2nd phase constructor is private. |
|
88 **/ |
|
89 void ConstructL(void); |
|
90 |
|
91 protected: // Functions from base classes |
|
92 /** |
|
93 * From CActive ?member_description |
|
94 **/ |
|
95 void RunL(void); |
|
96 |
|
97 /** |
|
98 * From CActive ?member_description |
|
99 **/ |
|
100 void DoCancel(void); |
|
101 |
|
102 private: // New functions |
|
103 /** |
|
104 * ?member_description. |
|
105 * @since Series 60 2.8 |
|
106 **/ |
|
107 void Subscribe(void); |
|
108 |
|
109 /** |
|
110 * ?member_description. |
|
111 * @since Series 60 3.0 |
|
112 **/ |
|
113 void NotifyCurrentValue(void); |
|
114 |
|
115 private: // Data |
|
116 // ?one_line_short_description_of_data |
|
117 RProperty iProperty; |
|
118 |
|
119 // ?one_line_short_description_of_data |
|
120 TUid iCategory; |
|
121 |
|
122 // ?one_line_short_description_of_data |
|
123 TUint iKey; |
|
124 |
|
125 // ?one_line_short_description_of_data |
|
126 MPropertyChangeHandler& iHandler; |
|
127 |
|
128 }; |
|
129 |
|
130 #endif // CPROPERTYOBSERVER_H |
|
131 |
|
132 |
|
133 // End of File |