|
1 /* |
|
2 * Copyright (c) 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: Implementation of the Phone Profile Settings API |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 // INCLUDE FILES |
|
22 #include "GlobalAudioSettingsImpl.h" |
|
23 #include <e32std.h> |
|
24 #include <GlobalAudioSettingsPSKeys.h> |
|
25 #include <MGlobalAudioSettingsObserver.h> |
|
26 #include <centralrepository.h> |
|
27 #include "AudioClientsListManagerAO.h" |
|
28 #include <AudioClientsListPSKeys.h> |
|
29 |
|
30 #ifdef _DEBUG |
|
31 #define PRINT_MESSAGE |
|
32 #endif // _DEBUG |
|
33 |
|
34 // ============================ MEMBER FUNCTIONS =============================== |
|
35 |
|
36 // ----------------------------------------------------------------------------- |
|
37 // CGlobalAudioSettingsImpl::NewL(); |
|
38 // |
|
39 // ----------------------------------------------------------------------------- |
|
40 // |
|
41 CGlobalAudioSettingsImpl::CGlobalAudioSettingsImpl( |
|
42 CGlobalAudioSettings &aGlobalAudioSettings, |
|
43 MAudioSettingsObserver& aAudioSettingsObserver) |
|
44 :iGlobalAudioSettings(aGlobalAudioSettings), |
|
45 iAudioSettingsObserver(aAudioSettingsObserver) |
|
46 { |
|
47 } |
|
48 |
|
49 // ----------------------------------------------------------------------------- |
|
50 // CGlobalAudioSettingsImpl::NewL(); |
|
51 // |
|
52 // ----------------------------------------------------------------------------- |
|
53 // |
|
54 EXPORT_C CGlobalAudioSettingsImpl* CGlobalAudioSettingsImpl::NewL( |
|
55 CGlobalAudioSettings &aGlobalAudioSettings, |
|
56 MAudioSettingsObserver& aAudioSettingsObserver) |
|
57 { |
|
58 CGlobalAudioSettingsImpl* self = new (ELeave) CGlobalAudioSettingsImpl( |
|
59 aGlobalAudioSettings,aAudioSettingsObserver); |
|
60 CleanupStack::PushL( self ); |
|
61 self->ConstructL(); |
|
62 CleanupStack::Pop( self ); |
|
63 return self; |
|
64 } |
|
65 |
|
66 // ----------------------------------------------------------------------------- |
|
67 // CGlobalAudioSettingsImpl::ConstructL(); |
|
68 // |
|
69 // ----------------------------------------------------------------------------- |
|
70 // |
|
71 void CGlobalAudioSettingsImpl::ConstructL() |
|
72 { |
|
73 iWarningTonesObserverAO = CWarningTonesObserverAO::NewL( |
|
74 iGlobalAudioSettings, |
|
75 iAudioSettingsObserver, |
|
76 iGlobalAudioSettingsData); |
|
77 iWarningTonesObserverAO->Subscribe(); |
|
78 |
|
79 iMessagingTonesObserverAO = CMessagingTonesObserverAO::NewL( |
|
80 iGlobalAudioSettings, |
|
81 iAudioSettingsObserver, |
|
82 iGlobalAudioSettingsData); |
|
83 iMessagingTonesObserverAO->Subscribe(); |
|
84 |
|
85 iSilentProfileObserverAO = CSilentProfileObserverAO::NewL( |
|
86 iGlobalAudioSettings, |
|
87 iAudioSettingsObserver, |
|
88 iGlobalAudioSettingsData); |
|
89 iSilentProfileObserverAO->Subscribe(); |
|
90 |
|
91 iVibraObserverAO = CVibraObserverAO::NewL( |
|
92 iGlobalAudioSettings, |
|
93 iAudioSettingsObserver, |
|
94 iGlobalAudioSettingsData); |
|
95 iVibraObserverAO->Subscribe(); |
|
96 |
|
97 RProperty publicSilenceProperty; |
|
98 User::LeaveIfError(publicSilenceProperty.Attach(KGASPSUidGlobalAudioSettings, KGASPublicSilence)); |
|
99 User::LeaveIfError(publicSilenceProperty.Get(iGlobalAudioSettingsData.iPublicSilence)); |
|
100 publicSilenceProperty.Close(); |
|
101 |
|
102 iCAudioClientsListManagerAO = CAudioClientsListManagerAO::NewL( iGlobalAudioSettings,iAudioClientsListObserverArray,KAudioPolicyAudioClients); |
|
103 |
|
104 iPausedClientsListManagerAO = CAudioClientsListManagerAO::NewL( iGlobalAudioSettings,iAudioClientsListObserverArray,KAudioPolicyApplicationAudioStatePaused ); |
|
105 } |
|
106 |
|
107 // Destructor |
|
108 EXPORT_C CGlobalAudioSettingsImpl::~CGlobalAudioSettingsImpl() |
|
109 { |
|
110 delete iWarningTonesObserverAO; |
|
111 delete iMessagingTonesObserverAO; |
|
112 delete iSilentProfileObserverAO; |
|
113 delete iVibraObserverAO; |
|
114 delete iCAudioClientsListManagerAO; |
|
115 delete iPausedClientsListManagerAO; |
|
116 iAudioClientsListObserverArray.Close(); |
|
117 } |
|
118 |
|
119 // ----------------------------------------------------------------------------- |
|
120 // CGlobalAudioSettingsImpl::NewL |
|
121 // Static function for creating an instance of the EnvironmentalReverb object. |
|
122 // ----------------------------------------------------------------------------- |
|
123 // |
|
124 EXPORT_C TBool CGlobalAudioSettingsImpl::IsWarningTonesEnabled() |
|
125 { |
|
126 if(iGlobalAudioSettingsData.iWarningTones) |
|
127 return(ETrue); |
|
128 else |
|
129 return(EFalse); |
|
130 } |
|
131 |
|
132 // ----------------------------------------------------------------------------- |
|
133 // CGlobalAudioSettingsImpl::IsMessageTonesEnabled |
|
134 // |
|
135 // ----------------------------------------------------------------------------- |
|
136 // |
|
137 EXPORT_C TBool CGlobalAudioSettingsImpl::IsMessageTonesEnabled() |
|
138 { |
|
139 if(iGlobalAudioSettingsData.iMessageTones) |
|
140 return(ETrue); |
|
141 else |
|
142 return(EFalse); |
|
143 } |
|
144 |
|
145 // ----------------------------------------------------------------------------- |
|
146 // CGlobalAudioSettingsImpl::IsSilentProfileEnabled |
|
147 // |
|
148 // ----------------------------------------------------------------------------- |
|
149 // |
|
150 EXPORT_C TBool CGlobalAudioSettingsImpl::IsSilentProfileEnabled() |
|
151 { |
|
152 if(iGlobalAudioSettingsData.iSilentProfile) |
|
153 return(ETrue); |
|
154 else |
|
155 return(EFalse); |
|
156 } |
|
157 |
|
158 // ----------------------------------------------------------------------------- |
|
159 // CGlobalAudioSettingsImpl::IsVibraEnabled |
|
160 // |
|
161 // ----------------------------------------------------------------------------- |
|
162 // |
|
163 EXPORT_C TBool CGlobalAudioSettingsImpl::IsVibraEnabled() |
|
164 { |
|
165 if(iGlobalAudioSettingsData.iVibra) |
|
166 return(ETrue); |
|
167 else |
|
168 return(EFalse); |
|
169 } |
|
170 |
|
171 // ----------------------------------------------------------------------------- |
|
172 // CGlobalAudioSettingsImpl::IsPublicSilenceEnabled |
|
173 // |
|
174 // ----------------------------------------------------------------------------- |
|
175 // |
|
176 EXPORT_C TBool CGlobalAudioSettingsImpl::IsPublicSilenceEnabled() |
|
177 { |
|
178 if(iGlobalAudioSettingsData.iPublicSilence) |
|
179 return(ETrue); |
|
180 else |
|
181 return(EFalse); |
|
182 } |
|
183 |
|
184 // ----------------------------------------------------------------------------- |
|
185 // CGlobalAudioSettingsImpl::RegisterAudioClientsListObserver |
|
186 // |
|
187 // ----------------------------------------------------------------------------- |
|
188 // |
|
189 TInt CGlobalAudioSettingsImpl::RegisterAudioClientsListObserver( |
|
190 MAudioClientsListObserver& aObserver ) |
|
191 { |
|
192 TInt status(KErrAlreadyExists); |
|
193 if ( iAudioClientsListObserverArray.Find( &aObserver ) == KErrNotFound ) |
|
194 { |
|
195 status = iAudioClientsListObserverArray.Append( &aObserver); |
|
196 if ( ( status == KErrNone ) && (iAudioClientsListObserverArray.Count() == 1 ) ) |
|
197 { |
|
198 iCAudioClientsListManagerAO->MonitorStart(); |
|
199 iPausedClientsListManagerAO->MonitorStart(); |
|
200 } |
|
201 } |
|
202 return status; |
|
203 } |
|
204 |
|
205 // ----------------------------------------------------------------------------- |
|
206 // CGlobalAudioSettingsImpl::UnregisterAudioClientsListObserver |
|
207 // |
|
208 // ----------------------------------------------------------------------------- |
|
209 // |
|
210 TInt CGlobalAudioSettingsImpl::UnregisterAudioClientsListObserver( |
|
211 MAudioClientsListObserver& aObserver) |
|
212 { |
|
213 TInt status(KErrNone); |
|
214 status = iAudioClientsListObserverArray.Find( &aObserver ); |
|
215 if ( status != KErrNotFound ) |
|
216 { |
|
217 iAudioClientsListObserverArray.Remove( status ); |
|
218 if ( iAudioClientsListObserverArray.Count() == 0 ) |
|
219 { |
|
220 iCAudioClientsListManagerAO->MonitorStop(); |
|
221 iPausedClientsListManagerAO->MonitorStop(); |
|
222 } |
|
223 } |
|
224 return status; |
|
225 } |
|
226 |
|
227 // ----------------------------------------------------------------------------- |
|
228 // CGlobalAudioSettingsImpl::GetAudioClientsList |
|
229 // |
|
230 // ----------------------------------------------------------------------------- |
|
231 // |
|
232 TInt CGlobalAudioSettingsImpl::GetAudioClientsList( |
|
233 CGlobalAudioSettings::TAudioClientListType aType, |
|
234 RArray<TProcessId>& aList ) |
|
235 { |
|
236 TInt status(KErrNone); |
|
237 |
|
238 switch(aType) |
|
239 { |
|
240 case CGlobalAudioSettings::EActiveAudioClients: |
|
241 { |
|
242 status = iCAudioClientsListManagerAO->GetAudioClientsList( aType, aList ); |
|
243 } |
|
244 break; |
|
245 case CGlobalAudioSettings::EPausedAudioClients: |
|
246 { |
|
247 status = iPausedClientsListManagerAO->GetAudioClientsList( aType, aList ); |
|
248 } |
|
249 break; |
|
250 default: |
|
251 break; |
|
252 |
|
253 } |
|
254 return status; |
|
255 |
|
256 |
|
257 } |
|
258 |
|
259 ////////////////////////////////////////////////////////////////////// |
|
260 // CWarningTonesObserverAO // |
|
261 ////////////////////////////////////////////////////////////////////// |
|
262 CWarningTonesObserverAO::CWarningTonesObserverAO( |
|
263 CGlobalAudioSettings &aGlobalAudioSettings, |
|
264 MAudioSettingsObserver& aAudioSettingsObserver, |
|
265 TGlobalAudioSettings& aGlobalAudioSettingsData) |
|
266 :CActive(EPriorityStandard), |
|
267 iGlobalAudioSettings(aGlobalAudioSettings), |
|
268 iAudioSettingsObserver(aAudioSettingsObserver), |
|
269 iGlobalAudioSettingsData(aGlobalAudioSettingsData) |
|
270 { |
|
271 CActiveScheduler::Add(this); |
|
272 } |
|
273 |
|
274 CWarningTonesObserverAO::~CWarningTonesObserverAO() |
|
275 { |
|
276 Cancel(); |
|
277 iWarningTonesProperty.Close(); |
|
278 } |
|
279 |
|
280 CWarningTonesObserverAO* CWarningTonesObserverAO::NewL( |
|
281 CGlobalAudioSettings &aGlobalAudioSettings, |
|
282 MAudioSettingsObserver& aAudioSettingsObserver, |
|
283 TGlobalAudioSettings& aGlobalAudioSettingsData) |
|
284 { |
|
285 CWarningTonesObserverAO* self = new (ELeave) CWarningTonesObserverAO( |
|
286 aGlobalAudioSettings, |
|
287 aAudioSettingsObserver, |
|
288 aGlobalAudioSettingsData); |
|
289 CleanupStack::PushL(self); |
|
290 self->ConstructL(); |
|
291 CleanupStack::Pop(); |
|
292 return self; |
|
293 } |
|
294 |
|
295 void CWarningTonesObserverAO::ConstructL() |
|
296 { |
|
297 User::LeaveIfError(iWarningTonesProperty.Attach(KGASPSUidGlobalAudioSettings, KGASWarningTones)); |
|
298 User::LeaveIfError(iWarningTonesProperty.Get(iGlobalAudioSettingsData.iWarningTones)); |
|
299 } |
|
300 |
|
301 void CWarningTonesObserverAO::Subscribe() |
|
302 { |
|
303 if (!IsActive()) |
|
304 { |
|
305 SetActive(); |
|
306 iWarningTonesProperty.Subscribe(iStatus); |
|
307 } |
|
308 } |
|
309 |
|
310 void CWarningTonesObserverAO::RunL() |
|
311 { |
|
312 TInt status(iStatus.Int()); |
|
313 #ifdef PRINT_MESSAGE |
|
314 RDebug::Print(_L(" CWarningTonesObserverAO::RunL:iStatus[%d]"), status); |
|
315 #endif // PRINT_MESSAGE |
|
316 if ( status == KErrNone ) |
|
317 { |
|
318 Subscribe(); |
|
319 status = iWarningTonesProperty.Get(iGlobalAudioSettingsData.iWarningTones); |
|
320 if(status == KErrNone) |
|
321 { |
|
322 iAudioSettingsObserver.SettingsChanged(iGlobalAudioSettings, MAudioSettingsObserver::KWarningTones ); |
|
323 } |
|
324 #ifdef PRINT_MESSAGE |
|
325 else |
|
326 { |
|
327 RDebug::Print(_L(" CWarningTonesObserverAO::RunL:Property.Get Error[%d]"), status); |
|
328 } |
|
329 #endif // PRINT_MESSAGE |
|
330 } |
|
331 } |
|
332 |
|
333 void CWarningTonesObserverAO::DoCancel() |
|
334 { |
|
335 iWarningTonesProperty.Cancel(); |
|
336 } |
|
337 |
|
338 TInt CWarningTonesObserverAO::RunError(TInt /*aError*/) |
|
339 { |
|
340 return KErrNone; |
|
341 } |
|
342 |
|
343 ////////////////////////////////////////////////////////////////////// |
|
344 // CMessagingTonesObserverAO // |
|
345 ////////////////////////////////////////////////////////////////////// |
|
346 CMessagingTonesObserverAO::CMessagingTonesObserverAO( |
|
347 CGlobalAudioSettings &aGlobalAudioSettings, |
|
348 MAudioSettingsObserver& aAudioSettingsObserver, |
|
349 TGlobalAudioSettings& aGlobalAudioSettingsData) |
|
350 :CActive(EPriorityStandard), |
|
351 iGlobalAudioSettings(aGlobalAudioSettings), |
|
352 iAudioSettingsObserver(aAudioSettingsObserver), |
|
353 iGlobalAudioSettingsData(aGlobalAudioSettingsData) |
|
354 { |
|
355 CActiveScheduler::Add(this); |
|
356 } |
|
357 |
|
358 CMessagingTonesObserverAO::~CMessagingTonesObserverAO() |
|
359 { |
|
360 Cancel(); |
|
361 iMessagingTonesProperty.Close(); |
|
362 } |
|
363 |
|
364 CMessagingTonesObserverAO* CMessagingTonesObserverAO::NewL( |
|
365 CGlobalAudioSettings &aGlobalAudioSettings, |
|
366 MAudioSettingsObserver& aAudioSettingsObserver, |
|
367 TGlobalAudioSettings& aGlobalAudioSettingsData) |
|
368 { |
|
369 CMessagingTonesObserverAO* self = new (ELeave) CMessagingTonesObserverAO( |
|
370 aGlobalAudioSettings, aAudioSettingsObserver, |
|
371 aGlobalAudioSettingsData); |
|
372 CleanupStack::PushL(self); |
|
373 self->ConstructL(); |
|
374 CleanupStack::Pop(); |
|
375 return self; |
|
376 } |
|
377 |
|
378 void CMessagingTonesObserverAO::ConstructL() |
|
379 { |
|
380 User::LeaveIfError(iMessagingTonesProperty.Attach(KGASPSUidGlobalAudioSettings, KGASMessageTones)); |
|
381 User::LeaveIfError(iMessagingTonesProperty.Get(iGlobalAudioSettingsData.iMessageTones)); |
|
382 } |
|
383 |
|
384 void CMessagingTonesObserverAO::Subscribe() |
|
385 { |
|
386 if (!IsActive()) |
|
387 { |
|
388 SetActive(); |
|
389 iMessagingTonesProperty.Subscribe(iStatus); |
|
390 } |
|
391 } |
|
392 |
|
393 void CMessagingTonesObserverAO::RunL() |
|
394 { |
|
395 TInt status(iStatus.Int()); |
|
396 #ifdef PRINT_MESSAGE |
|
397 RDebug::Print(_L(" CMessagingTonesObserverAO::RunL:iStatus[%d]"), status); |
|
398 #endif // PRINT_MESSAGE |
|
399 if ( status == KErrNone ) |
|
400 { |
|
401 Subscribe(); |
|
402 status = iMessagingTonesProperty.Get(iGlobalAudioSettingsData.iMessageTones); |
|
403 if(status == KErrNone) |
|
404 { |
|
405 iAudioSettingsObserver.SettingsChanged(iGlobalAudioSettings, MAudioSettingsObserver::KMessageTones); |
|
406 } |
|
407 #ifdef PRINT_MESSAGE |
|
408 else |
|
409 { |
|
410 RDebug::Print(_L(" CMessagingTonesObserverAO::RunL:Property.Get Error[%d]"), status); |
|
411 } |
|
412 #endif // PRINT_MESSAGE |
|
413 } |
|
414 } |
|
415 |
|
416 void CMessagingTonesObserverAO::DoCancel() |
|
417 { |
|
418 iMessagingTonesProperty.Cancel(); |
|
419 } |
|
420 |
|
421 TInt CMessagingTonesObserverAO::RunError(TInt /*aError*/) |
|
422 { |
|
423 return KErrNone; |
|
424 } |
|
425 |
|
426 ////////////////////////////////////////////////////////////////////// |
|
427 // CSilentProfileObserverAO // |
|
428 ////////////////////////////////////////////////////////////////////// |
|
429 CSilentProfileObserverAO::CSilentProfileObserverAO( |
|
430 CGlobalAudioSettings &aGlobalAudioSettings, |
|
431 MAudioSettingsObserver& aAudioSettingsObserver, |
|
432 TGlobalAudioSettings& aGlobalAudioSettingsData) |
|
433 :CActive(EPriorityStandard), |
|
434 iGlobalAudioSettings(aGlobalAudioSettings), |
|
435 iAudioSettingsObserver(aAudioSettingsObserver), |
|
436 iGlobalAudioSettingsData(aGlobalAudioSettingsData) |
|
437 { |
|
438 CActiveScheduler::Add(this); |
|
439 } |
|
440 |
|
441 CSilentProfileObserverAO::~CSilentProfileObserverAO() |
|
442 { |
|
443 Cancel(); |
|
444 iSilentProfileProperty.Close(); |
|
445 } |
|
446 |
|
447 CSilentProfileObserverAO* CSilentProfileObserverAO::NewL( |
|
448 CGlobalAudioSettings &aGlobalAudioSettings, |
|
449 MAudioSettingsObserver& aAudioSettingsObserver, |
|
450 TGlobalAudioSettings& aGlobalAudioSettingsData) |
|
451 { |
|
452 CSilentProfileObserverAO* self = new (ELeave) CSilentProfileObserverAO( |
|
453 aGlobalAudioSettings, aAudioSettingsObserver, |
|
454 aGlobalAudioSettingsData); |
|
455 CleanupStack::PushL(self); |
|
456 self->ConstructL(); |
|
457 CleanupStack::Pop(); |
|
458 return self; |
|
459 } |
|
460 |
|
461 void CSilentProfileObserverAO::ConstructL() |
|
462 { |
|
463 User::LeaveIfError(iSilentProfileProperty.Attach(KGASPSUidGlobalAudioSettings, KGASSilentProfile)); |
|
464 User::LeaveIfError(iSilentProfileProperty.Get(iGlobalAudioSettingsData.iSilentProfile)); |
|
465 } |
|
466 |
|
467 void CSilentProfileObserverAO::Subscribe() |
|
468 { |
|
469 if (!IsActive()) |
|
470 { |
|
471 SetActive(); |
|
472 iSilentProfileProperty.Subscribe(iStatus); |
|
473 } |
|
474 } |
|
475 |
|
476 void CSilentProfileObserverAO::RunL() |
|
477 { |
|
478 TInt status(iStatus.Int()); |
|
479 #ifdef PRINT_MESSAGE |
|
480 RDebug::Print(_L(" CSilentProfileObserverAO::RunL:iStatus[%d]"), status); |
|
481 #endif // PRINT_MESSAGE |
|
482 if ( status == KErrNone ) |
|
483 { |
|
484 Subscribe(); |
|
485 status = iSilentProfileProperty.Get(iGlobalAudioSettingsData.iSilentProfile); |
|
486 if(status == KErrNone) |
|
487 { |
|
488 iAudioSettingsObserver.SettingsChanged(iGlobalAudioSettings, MAudioSettingsObserver::KSilentProfile); |
|
489 } |
|
490 #ifdef PRINT_MESSAGE |
|
491 else |
|
492 { |
|
493 RDebug::Print(_L(" CSilentProfileObserverAO::RunL:Property.Get Error[%d]"), status); |
|
494 } |
|
495 #endif // PRINT_MESSAGE |
|
496 } |
|
497 } |
|
498 |
|
499 void CSilentProfileObserverAO::DoCancel() |
|
500 { |
|
501 iSilentProfileProperty.Cancel(); |
|
502 } |
|
503 |
|
504 TInt CSilentProfileObserverAO::RunError(TInt /*aError*/) |
|
505 { |
|
506 return KErrNone; |
|
507 } |
|
508 |
|
509 ////////////////////////////////////////////////////////////////////// |
|
510 // CVibraObserverAO // |
|
511 ////////////////////////////////////////////////////////////////////// |
|
512 CVibraObserverAO::CVibraObserverAO( |
|
513 CGlobalAudioSettings &aGlobalAudioSettings, |
|
514 MAudioSettingsObserver& aAudioSettingsObserver, |
|
515 TGlobalAudioSettings& aGlobalAudioSettingsData) |
|
516 :CActive(EPriorityStandard), |
|
517 iGlobalAudioSettings(aGlobalAudioSettings), |
|
518 iAudioSettingsObserver(aAudioSettingsObserver), |
|
519 iGlobalAudioSettingsData(aGlobalAudioSettingsData) |
|
520 { |
|
521 CActiveScheduler::Add(this); |
|
522 } |
|
523 |
|
524 CVibraObserverAO::~CVibraObserverAO() |
|
525 { |
|
526 Cancel(); |
|
527 iVibraProperty.Close(); |
|
528 } |
|
529 |
|
530 CVibraObserverAO* CVibraObserverAO::NewL( |
|
531 CGlobalAudioSettings &aGlobalAudioSettings, |
|
532 MAudioSettingsObserver& aAudioSettingsObserver, |
|
533 TGlobalAudioSettings& aGlobalAudioSettingsData) |
|
534 { |
|
535 CVibraObserverAO* self = new (ELeave) CVibraObserverAO( |
|
536 aGlobalAudioSettings, |
|
537 aAudioSettingsObserver, |
|
538 aGlobalAudioSettingsData); |
|
539 CleanupStack::PushL(self); |
|
540 self->ConstructL(); |
|
541 CleanupStack::Pop(); |
|
542 return self; |
|
543 } |
|
544 |
|
545 void CVibraObserverAO::ConstructL() |
|
546 { |
|
547 User::LeaveIfError(iVibraProperty.Attach(KGASPSUidGlobalAudioSettings, KGASVibra)); |
|
548 User::LeaveIfError(iVibraProperty.Get(iGlobalAudioSettingsData.iVibra)); |
|
549 } |
|
550 |
|
551 void CVibraObserverAO::Subscribe() |
|
552 { |
|
553 if (!IsActive()) |
|
554 { |
|
555 SetActive(); |
|
556 iVibraProperty.Subscribe(iStatus); |
|
557 } |
|
558 } |
|
559 |
|
560 void CVibraObserverAO::RunL() |
|
561 { |
|
562 TInt status(iStatus.Int()); |
|
563 #ifdef PRINT_MESSAGE |
|
564 RDebug::Print(_L(" CVibraObserverAO::RunL:iStatus[%d]"), status); |
|
565 #endif // PRINT_MESSAGE |
|
566 if ( status == KErrNone ) |
|
567 { |
|
568 Subscribe(); |
|
569 status = iVibraProperty.Get(iGlobalAudioSettingsData.iVibra); |
|
570 if( status == KErrNone) |
|
571 { |
|
572 iAudioSettingsObserver.SettingsChanged(iGlobalAudioSettings, MAudioSettingsObserver::KVibra); |
|
573 } |
|
574 #ifdef PRINT_MESSAGE |
|
575 else |
|
576 { |
|
577 RDebug::Print(_L(" CVibraObserverAO::RunL:Property.Get Error[%d]"), status); |
|
578 } |
|
579 #endif // PRINT_MESSAGE |
|
580 } |
|
581 } |
|
582 |
|
583 void CVibraObserverAO::DoCancel() |
|
584 { |
|
585 iVibraProperty.Cancel(); |
|
586 } |
|
587 |
|
588 TInt CVibraObserverAO::RunError(TInt /*aError*/) |
|
589 { |
|
590 return KErrNone; |
|
591 } |
|
592 |
|
593 //End of file |