|
1 /* |
|
2 * Copyright (c) 2005-2007 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: Provide interface for the client requestin availability class. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "musavatelephonystatusbase.h" |
|
20 #include "musavatelephonystatusobserver.h" |
|
21 #include "musavaavailability.h" |
|
22 #include "musunittesting.h" |
|
23 #include "muslogger.h" |
|
24 |
|
25 #include <e32base.h> |
|
26 |
|
27 |
|
28 // ------------------------------------------------------------------------- |
|
29 // Destructor. |
|
30 // ------------------------------------------------------------------------- |
|
31 // |
|
32 CMusAvaTelephonyStatusBase::~CMusAvaTelephonyStatusBase() |
|
33 { |
|
34 CActive::Cancel(); |
|
35 } |
|
36 |
|
37 // ----------------------------------------------------------------------------- |
|
38 // Adds new observer |
|
39 // ----------------------------------------------------------------------------- |
|
40 void CMusAvaTelephonyStatusBase::AddAdapterL( MMusAvaTelephonyStatusObserver& aAdapter ) |
|
41 { |
|
42 MUS_LOG( "mus: [MUSAVA] -> CMusAvaTelephonyStatusBase::\ |
|
43 AddAdapterL( MMusAvaTelephonyStatusObserver& aAdapter )" ) |
|
44 iObserver.AppendL( &aAdapter ); |
|
45 |
|
46 MUS_LOG( "mus: [MUSAVA] <- CMusAvaSip::\ |
|
47 AddAdapterL( MMusAvaTelephonyStatusObserver& aAdapter )" ) |
|
48 } |
|
49 |
|
50 |
|
51 // ------------------------------------------------------------------------- |
|
52 // Reads the telephony status. |
|
53 // ------------------------------------------------------------------------- |
|
54 // |
|
55 void CMusAvaTelephonyStatusBase::TelephonyStatus() |
|
56 { |
|
57 MUS_LOG( "mus: [MUSAVA] -> CMusAvaTelephonyStatusBase::TelephonyStatus()" ) |
|
58 |
|
59 MUS_LOG( "mus: [MUSAVA] -> CMusAvaTelephonyStatusBase::TelephonyStatus()" ) |
|
60 } |
|
61 |
|
62 // ----------------------------------------------------------------------------- |
|
63 // Removes the adapter |
|
64 // ----------------------------------------------------------------------------- |
|
65 void CMusAvaTelephonyStatusBase::RemoveAdapter( |
|
66 MMusAvaTelephonyStatusObserver& aAdapter ) |
|
67 { |
|
68 MUS_LOG( "mus: [MUSAVA] -> CMusAvaTelephonyStatusBase::\ |
|
69 RemoveAdapter( MMusAvaTelephonyStatusObserver& aAdapter )" ) |
|
70 TInt index = iObserver.Find( &aAdapter ); |
|
71 |
|
72 if( index != KErrNotFound ) |
|
73 { |
|
74 iObserver.Remove( index ); |
|
75 } |
|
76 |
|
77 if( iObserver.Count() == 0 ) |
|
78 { |
|
79 CActive::Cancel(); |
|
80 } |
|
81 MUS_LOG( "mus: [MUSAVA] <- CMusAvaSip::\ |
|
82 RemoveAdapter( MMusAvaTelephonyStatusObserver& aAdapter )" ) |
|
83 } |
|
84 // ------------------------------------------------------------------------- |
|
85 // Derived from CActive. |
|
86 // ------------------------------------------------------------------------- |
|
87 // |
|
88 void CMusAvaTelephonyStatusBase::RunL() |
|
89 { |
|
90 MUS_LOG( "mus: [MUSAVA] -> CMusAvaTelephonyStatusBase::RunL()" ) |
|
91 |
|
92 MUS_LOG( "mus: [MUSAVA] <- CMusAvaTelephonyStatusBase::RunL()" ) |
|
93 } |
|
94 |
|
95 // ------------------------------------------------------------------------- |
|
96 // Derived from CActive. Called after somebody calls Cancel; |
|
97 // ------------------------------------------------------------------------- |
|
98 // |
|
99 void CMusAvaTelephonyStatusBase::DoCancel() |
|
100 { |
|
101 |
|
102 } |
|
103 |
|
104 // ------------------------------------------------------------------------- |
|
105 // If RunL() leaves,It should be handled here. |
|
106 // ------------------------------------------------------------------------- |
|
107 // |
|
108 TInt CMusAvaTelephonyStatusBase::RunError( TInt aError ) |
|
109 { |
|
110 MUS_LOG1( "mus: [MUSAVA] -> CMusAvaTelephonyStatusBase::\ |
|
111 RunError() return #%d", aError ) |
|
112 |
|
113 // Nothing can be done here. |
|
114 aError = KErrNone; |
|
115 |
|
116 MUS_LOG( "mus: [MUSAVA] <- CMusAvaTelephonyStatusBase::RunError()" ) |
|
117 return aError; |
|
118 } |
|
119 |
|
120 // ------------------------------------------------------------------------- |
|
121 // Constructor function. |
|
122 // ------------------------------------------------------------------------- |
|
123 // |
|
124 CMusAvaTelephonyStatusBase::CMusAvaTelephonyStatusBase( ) |
|
125 : CActive( EPriorityStandard ) |
|
126 { |
|
127 CActiveScheduler::Add( this ); |
|
128 } |
|
129 |