|
1 /* |
|
2 * Copyright (c) 2004-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: Video call CR listener. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include "CVtEngCRObserverItem.h" |
|
22 #include <centralrepository.h> |
|
23 #include "MVtEngCRSettingObserver.h" |
|
24 #include <cvtlogger.h> |
|
25 |
|
26 // ============================ MEMBER FUNCTIONS =============================== |
|
27 |
|
28 // ----------------------------------------------------------------------------- |
|
29 // CVtEngCRObserverItem::CVtEngCRObserverItem |
|
30 // C++ default constructor can NOT contain any code, that |
|
31 // might leave. |
|
32 // ----------------------------------------------------------------------------- |
|
33 // |
|
34 CVtEngCRObserverItem::CVtEngCRObserverItem( |
|
35 MVtEngCRSettingObserver* aObserver, |
|
36 TUid aUid, TUint32 aKey, |
|
37 CCenRepNotifyHandler::TCenRepKeyType aType ) : |
|
38 iObserver( aObserver ), iUid( aUid ), iKey( aKey ), iType( aType ), |
|
39 iNotifier( NULL ) |
|
40 { |
|
41 } |
|
42 |
|
43 // ----------------------------------------------------------------------------- |
|
44 // CVtEngCRObserverItem::NewL |
|
45 // Two-phased constructor. |
|
46 // ----------------------------------------------------------------------------- |
|
47 // |
|
48 CVtEngCRObserverItem* CVtEngCRObserverItem::NewL( |
|
49 MVtEngCRSettingObserver* aObserver, |
|
50 TUid aUid, TUint32 aKey, |
|
51 CCenRepNotifyHandler::TCenRepKeyType aType ) |
|
52 { |
|
53 __VTPRINTENTER( "CRListener.NewL" ) |
|
54 CVtEngCRObserverItem* self = |
|
55 new( ELeave ) CVtEngCRObserverItem( aObserver, aUid, aKey, aType ); |
|
56 __VTPRINTEXIT( "CRListener.NewL" ) |
|
57 return self; |
|
58 } |
|
59 |
|
60 // ----------------------------------------------------------------------------- |
|
61 // CVtEngCRObserverItem::~CVtEngCRObserverItem |
|
62 // Destructor. |
|
63 // ----------------------------------------------------------------------------- |
|
64 // |
|
65 CVtEngCRObserverItem::~CVtEngCRObserverItem() |
|
66 { |
|
67 __VTPRINTENTER( "CRListener.~" ) |
|
68 if ( iNotifier ) |
|
69 { |
|
70 iNotifier->StopListening(); |
|
71 } |
|
72 delete iNotifier; |
|
73 __VTPRINTEXIT( "CRListener.~" ) |
|
74 } |
|
75 |
|
76 // ----------------------------------------------------------------------------- |
|
77 // CVtEngCRObserverItem::Offer |
|
78 // Checks if uid and id match this observer's. |
|
79 // ----------------------------------------------------------------------------- |
|
80 // |
|
81 TBool CVtEngCRObserverItem::Offer( const TUid aUid, const TUint32 aKey ) const |
|
82 { |
|
83 return aUid == iUid && iKey == aKey ? ETrue : EFalse; |
|
84 } |
|
85 |
|
86 // ----------------------------------------------------------------------------- |
|
87 // CVtEngCRObserverItem::Offer |
|
88 // Checks if uid matches this observer's. |
|
89 // ----------------------------------------------------------------------------- |
|
90 // |
|
91 TBool CVtEngCRObserverItem::Offer( const TUid aUid ) const |
|
92 { |
|
93 return aUid == iUid ? ETrue : EFalse; |
|
94 } |
|
95 |
|
96 // ----------------------------------------------------------------------------- |
|
97 // CVtEngCRObserverItem::Offer |
|
98 // Checks if id matches this observer's. |
|
99 // ----------------------------------------------------------------------------- |
|
100 // |
|
101 TBool CVtEngCRObserverItem::Offer( const TUint32 aKey ) const |
|
102 { |
|
103 return iKey == aKey ? ETrue : EFalse; |
|
104 } |
|
105 |
|
106 // ----------------------------------------------------------------------------- |
|
107 // CVtEngCRObserverItem::SetCenRepNotifier |
|
108 // Sets the actual change handler to this object. |
|
109 // ----------------------------------------------------------------------------- |
|
110 // |
|
111 void CVtEngCRObserverItem::SetCenRepNotifier( CCenRepNotifyHandler* aNotifier ) |
|
112 { |
|
113 iNotifier = aNotifier; |
|
114 } |
|
115 |
|
116 // ----------------------------------------------------------------------------- |
|
117 // CVtEngCRObserverItem::HandleNotifyInt |
|
118 // Callback of changed int value. |
|
119 // ----------------------------------------------------------------------------- |
|
120 // |
|
121 void CVtEngCRObserverItem::HandleNotifyInt( TUint32 aId, TInt aNewValue ) |
|
122 { |
|
123 __VTPRINTENTER( "CRListener.Int" ) |
|
124 iObserver->HandleNotifyInt( iUid, aId, aNewValue ); |
|
125 __VTPRINTEXIT( "CRListener.Int" ) |
|
126 } |
|
127 |
|
128 // ----------------------------------------------------------------------------- |
|
129 // CVtEngCRObserverItem::HandleNotifyReal |
|
130 // Callback of changed real value. |
|
131 // ----------------------------------------------------------------------------- |
|
132 // |
|
133 void CVtEngCRObserverItem::HandleNotifyReal( TUint32 aId, TReal aNewValue ) |
|
134 { |
|
135 __VTPRINTENTER( "CRListener.Real" ) |
|
136 iObserver->HandleNotifyReal( iUid, aId, aNewValue ); |
|
137 __VTPRINTEXIT( "CRListener.Real" ) |
|
138 } |
|
139 |
|
140 // ----------------------------------------------------------------------------- |
|
141 // CVtEngCRObserverItem::HandleNotifyString |
|
142 // Callback of changed string value. |
|
143 // ----------------------------------------------------------------------------- |
|
144 // |
|
145 void CVtEngCRObserverItem::HandleNotifyString( TUint32 aId, |
|
146 const TDesC16& aNewValue ) |
|
147 { |
|
148 __VTPRINTENTER( "CRListener.String" ) |
|
149 iObserver->HandleNotifyString( iUid, aId, aNewValue ); |
|
150 __VTPRINTEXIT( "CRListener.String" ) |
|
151 } |
|
152 |
|
153 // ----------------------------------------------------------------------------- |
|
154 // CVtEngCRObserverItem::HandleNotifyBinary |
|
155 // Callback of changed binary value. |
|
156 // ----------------------------------------------------------------------------- |
|
157 // |
|
158 void CVtEngCRObserverItem::HandleNotifyBinary( TUint32 /* aId */, |
|
159 const TDesC8& /* aNewValue */ ) |
|
160 { |
|
161 __VTPRINTENTER( "CRListener.Binary" ) |
|
162 __VTPRINTEXIT( "CRListener.Binary" ) |
|
163 } |
|
164 |
|
165 // ----------------------------------------------------------------------------- |
|
166 // CVtEngCRObserverItem::HandleNotifyGeneric |
|
167 // Callback of a change in central repository. |
|
168 // ----------------------------------------------------------------------------- |
|
169 // |
|
170 void CVtEngCRObserverItem::HandleNotifyGeneric( TUint32 /* aId */ ) |
|
171 { |
|
172 __VTPRINTENTER( "CRListener.Generic" ) |
|
173 __VTPRINTEXIT( "CRListener.Generic" ) |
|
174 } |
|
175 |
|
176 // ----------------------------------------------------------------------------- |
|
177 // CVtEngCRObserverItem::HandleNotifyError |
|
178 // Callback of an error occurred. |
|
179 // ----------------------------------------------------------------------------- |
|
180 // |
|
181 #ifdef VTDEBUG |
|
182 void CVtEngCRObserverItem::HandleNotifyError( TUint32 aId, TInt aError, |
|
183 CCenRepNotifyHandler* /* aHandler */ ) |
|
184 #else |
|
185 void CVtEngCRObserverItem::HandleNotifyError( |
|
186 TUint32 /* aId */, TInt /* aError */, CCenRepNotifyHandler* /* aHandler */ ) |
|
187 #endif // VTDEBUG |
|
188 { |
|
189 __VTPRINT3( DEBUG_GEN, "CRListener.error id=%d,err=%d ", aId, aError ) |
|
190 } |
|
191 |
|
192 // ----------------------------------------------------------------------------- |
|
193 // CVtEngCRObserverItem::Uid |
|
194 // Returns Uid for this observer. |
|
195 // ----------------------------------------------------------------------------- |
|
196 // |
|
197 TUid CVtEngCRObserverItem::Uid() const |
|
198 { |
|
199 return iUid; |
|
200 } |
|
201 |
|
202 // ----------------------------------------------------------------------------- |
|
203 // CVtEngCRObserverItem::Key |
|
204 // Returns Key for this observer. |
|
205 // ----------------------------------------------------------------------------- |
|
206 // |
|
207 TUint32 CVtEngCRObserverItem::Key() const |
|
208 { |
|
209 return iKey; |
|
210 } |
|
211 |
|
212 // ----------------------------------------------------------------------------- |
|
213 // CVtEngCRObserverItem::Notifier |
|
214 // Returns Notifier for this observer. |
|
215 // ----------------------------------------------------------------------------- |
|
216 // |
|
217 CCenRepNotifyHandler* CVtEngCRObserverItem::Notifier() const |
|
218 { |
|
219 return iNotifier; |
|
220 } |
|
221 |
|
222 // ----------------------------------------------------------------------------- |
|
223 // CVtEngCRObserverItem::Type |
|
224 // Returns Type for this observer. |
|
225 // ----------------------------------------------------------------------------- |
|
226 // |
|
227 CCenRepNotifyHandler::TCenRepKeyType CVtEngCRObserverItem::Type() const |
|
228 { |
|
229 return iType; |
|
230 } |
|
231 |
|
232 // ----------------------------------------------------------------------------- |
|
233 // CVtEngCRObserverItem::Observer |
|
234 // Returns true observer for this observer. |
|
235 // ----------------------------------------------------------------------------- |
|
236 // |
|
237 MVtEngCRSettingObserver* CVtEngCRObserverItem::Observer() const |
|
238 { |
|
239 return iObserver; |
|
240 } |
|
241 |
|
242 // End of File |