1 /* |
|
2 * Copyright (c) 2005-2008 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 that tracks changes on a PS property. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef C_VCCPSPROPERTYLISTENER_H |
|
21 #define C_VCCPSPROPERTYLISTENER_H |
|
22 |
|
23 #include <e32base.h> |
|
24 #include <e32property.h> |
|
25 |
|
26 #include "mvccpspropertylistenerobserver.h" |
|
27 |
|
28 /* |
|
29 * CVccUiPsPropertyListener notes its observers when the value of the VCC |
|
30 * property changes. |
|
31 * |
|
32 * This class can get notifications about the VCC properties. |
|
33 * |
|
34 * @code |
|
35 * void CExampleClass::ConstructL() |
|
36 * { |
|
37 * CVccUiPsPropertyListener* iHoStatusListener = |
|
38 * CVccUiPsPropertyListener::NewL( KVccPropKeyHoStatus ); |
|
39 * iHoStatusListener.AddObserver( this ); |
|
40 * iHoStatusListener.Start(); |
|
41 * } |
|
42 * |
|
43 * void CExampleClass::VccPropertyChangedL( const TUint aKeyId, |
|
44 const TInt aValue ) |
|
45 * { |
|
46 * if( aKeyId ) |
|
47 * { |
|
48 * switch( aValue ) |
|
49 * { |
|
50 * case EVccCsToPsHoStarted: |
|
51 * // show UI notification |
|
52 * break; |
|
53 * default: |
|
54 * break; |
|
55 * } |
|
56 * } |
|
57 * } |
|
58 * |
|
59 * @endcode |
|
60 * |
|
61 * @lib vccuipropertyhandler.lib |
|
62 * @since S60 v3.2 |
|
63 */ |
|
64 class CVccUiPsPropertyListener : public CActive |
|
65 { |
|
66 public: |
|
67 |
|
68 /** |
|
69 * Symbian two-phased constructor. |
|
70 * |
|
71 * @param aKeyId Id of a key of the property. |
|
72 */ |
|
73 IMPORT_C static CVccUiPsPropertyListener* NewL( const TUint aKeyId ); |
|
74 |
|
75 /** |
|
76 * Destructor. |
|
77 */ |
|
78 IMPORT_C virtual ~CVccUiPsPropertyListener(); |
|
79 |
|
80 /** |
|
81 * Add an observer |
|
82 * @param aObserver Reference to observer object |
|
83 */ |
|
84 IMPORT_C void AddObserverL( MVccPsPropertyListenerObserver& aObserver ); |
|
85 |
|
86 /** |
|
87 * Remove an observer. |
|
88 * @param aObserver Reference to observer object |
|
89 */ |
|
90 IMPORT_C void RemoveObserver( MVccPsPropertyListenerObserver& aObserver ); |
|
91 |
|
92 /** |
|
93 * Get the current value of the property. |
|
94 * @return Property value |
|
95 */ |
|
96 IMPORT_C TInt CurrentValue(); |
|
97 |
|
98 /** |
|
99 * Start the listener. The listener subscribes to the given property. |
|
100 */ |
|
101 IMPORT_C void Start(); |
|
102 |
|
103 private: |
|
104 |
|
105 /** |
|
106 * Constructor. |
|
107 * |
|
108 * @param aKeyId Id of a key of the property. |
|
109 */ |
|
110 CVccUiPsPropertyListener( const TUint aKeyId ); |
|
111 |
|
112 /** |
|
113 * Symbian 2nd phase constructor |
|
114 */ |
|
115 void ConstructL(); |
|
116 |
|
117 /** |
|
118 * Notifies the observers about the Ho state change. |
|
119 */ |
|
120 void NotifyObserversL(); |
|
121 |
|
122 // from base class CActive. |
|
123 |
|
124 /** |
|
125 * @see CActive::RunL() |
|
126 */ |
|
127 void RunL(); |
|
128 |
|
129 /** |
|
130 * @see CActive::DoCancel() |
|
131 */ |
|
132 void DoCancel(); |
|
133 |
|
134 private: //data |
|
135 |
|
136 /** |
|
137 * The uid of the property category to be watched. |
|
138 */ |
|
139 TUid iCategoryId; |
|
140 |
|
141 /** |
|
142 * The property key uid to be watched. |
|
143 */ |
|
144 TUint iKeyId; |
|
145 |
|
146 /** |
|
147 * the property category. |
|
148 */ |
|
149 RProperty iProperty; |
|
150 |
|
151 /** |
|
152 * Obsevers for callback from this. |
|
153 * Observers are not owned. |
|
154 */ |
|
155 RPointerArray<MVccPsPropertyListenerObserver> iObservers; |
|
156 |
|
157 }; |
|
158 |
|
159 #endif // C_VCCPSPROPERTYLISTENER_H |
|
160 |
|