41
|
1 |
/*
|
|
2 |
* Copyright (c) 2010 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: Notify service class about connection state.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#include "cautoaudioasypropertyobserver.h"
|
|
19 |
#include "autoaudiopskeys.h"
|
|
20 |
#include "mautoaudioasypropertylistener.h"
|
|
21 |
|
|
22 |
#include "acc_debug.h"
|
|
23 |
|
|
24 |
// ---------------------------------------------------------------------------
|
|
25 |
// CAutoAudioAsyPropertyObserver::NewL
|
|
26 |
// ---------------------------------------------------------------------------
|
|
27 |
CAutoAudioAsyPropertyObserver* CAutoAudioAsyPropertyObserver::NewL ( TUid aCategory, TUint aKey,
|
|
28 |
MAutoAudioAsyPropertyListener& aListener )
|
|
29 |
{
|
|
30 |
COM_TRACE_1 ( "[AccFW:AutoAudioAsy] CAutoAudioAsyPropertyObserver::NewL(), key- %d", aKey );
|
|
31 |
return new ( ELeave ) CAutoAudioAsyPropertyObserver ( aCategory, aKey, aListener );
|
|
32 |
}
|
|
33 |
|
|
34 |
// ---------------------------------------------------------------------------
|
|
35 |
// CAutoAudioAsyPropertyObserver::CAutoAudioAsyPropertyObserver
|
|
36 |
// ---------------------------------------------------------------------------
|
|
37 |
CAutoAudioAsyPropertyObserver::CAutoAudioAsyPropertyObserver ( TUid aCategory, TUint aKey,
|
|
38 |
MAutoAudioAsyPropertyListener& aListener ):
|
|
39 |
CActive ( EPriorityStandard ),
|
|
40 |
iCategory ( aCategory ), iKey ( aKey ), iListener ( aListener )
|
|
41 |
{
|
|
42 |
CActiveScheduler::Add ( this );
|
|
43 |
iProperty.Attach ( iCategory, iKey );
|
|
44 |
iProperty.Subscribe ( iStatus );
|
|
45 |
SetActive ();
|
|
46 |
}
|
|
47 |
|
|
48 |
// ---------------------------------------------------------------------------
|
|
49 |
// CAutoAudioAsyPropertyObserver::~CAutoAudioAsyPropertyObserver
|
|
50 |
// ---------------------------------------------------------------------------
|
|
51 |
CAutoAudioAsyPropertyObserver::~CAutoAudioAsyPropertyObserver ()
|
|
52 |
{
|
|
53 |
COM_TRACE_ ( "[AccFW:AutoAudioAsy] CAutoAudioAsyPropertyObserver::~CAutoAudioAsyPropertyObserver");
|
|
54 |
Cancel ();
|
|
55 |
iProperty.Close ();
|
|
56 |
}
|
|
57 |
|
|
58 |
// ---------------------------------------------------------------------------
|
|
59 |
// CAutoAudioAsyPropertyObserver::RunL
|
|
60 |
// ---------------------------------------------------------------------------
|
|
61 |
void CAutoAudioAsyPropertyObserver::RunL ()
|
|
62 |
{
|
|
63 |
COM_TRACE_ ( "AccFW:AutoAudioAsy] CAutoAudioAsyPropertyObserver::RunL");
|
|
64 |
|
|
65 |
TInt status = iStatus.Int ();
|
|
66 |
COM_TRACE_3 ( "[AccFW:AutoAudioAsy] key 0x%08x/%u changed, status %d", iCategory.iUid, iKey, status );
|
|
67 |
// Subscribe for the next change BEFORE invoking the listener to make sure
|
|
68 |
// that we never miss any property changes.
|
|
69 |
iProperty.Subscribe ( iStatus );
|
|
70 |
SetActive ();
|
|
71 |
|
|
72 |
// Notify the listener
|
|
73 |
iListener.PropertyChange ( iProperty, iCategory, iKey, status );
|
|
74 |
}
|
|
75 |
|
|
76 |
// ---------------------------------------------------------------------------
|
|
77 |
// CAutoAudioAsyPropertyObserver::DoCancel
|
|
78 |
// ---------------------------------------------------------------------------
|
|
79 |
void CAutoAudioAsyPropertyObserver::DoCancel ()
|
|
80 |
{
|
|
81 |
COM_TRACE_ ( "[AccFW:AutoAudioAsy] CAutoAudioAsyPropertyObserver::DoCancel" );
|
|
82 |
iProperty.Cancel ();
|
|
83 |
}
|
|
84 |
|
|
85 |
// ---------------------------------------------------------------------------
|
|
86 |
// CAutoAudioAsyPropertyObserver::RunError
|
|
87 |
// ---------------------------------------------------------------------------
|
|
88 |
TInt CAutoAudioAsyPropertyObserver::RunError ( TInt /* aError */ )
|
|
89 |
{
|
|
90 |
COM_TRACE_ ( "[AccFW:AutoAudioAsy] CAutoAudioAsyPropertyObserver::RunError" );
|
|
91 |
return KErrNone;
|
|
92 |
}
|