1 /* |
|
2 * Copyright (c) 2005 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // USER INCLUDES |
|
20 #include "musengsession.h" |
|
21 #include "musengsessionobserver.h" |
|
22 #include "musengtelephoneutils.h" |
|
23 #include "muslogger.h" |
|
24 |
|
25 // SYSTEM INCLUDES |
|
26 |
|
27 #include <e32cmn.h> |
|
28 |
|
29 // ----------------------------------------------------------------------------- |
|
30 // |
|
31 // ----------------------------------------------------------------------------- |
|
32 // |
|
33 CMusEngSession::~CMusEngSession() // destruct - virtual, so no export |
|
34 { |
|
35 MUS_LOG( "mus: [ENGINE] -> CMusEngSession::~CMusEngSession()" ) |
|
36 delete iTelephoneUtils; |
|
37 MUS_LOG( "mus: [ENGINE] <- CMusEngSession::~CMusEngSession()" ) |
|
38 } |
|
39 |
|
40 |
|
41 // ----------------------------------------------------------------------------- |
|
42 // |
|
43 // ----------------------------------------------------------------------------- |
|
44 // |
|
45 EXPORT_C TRect CMusEngSession::Rect() const |
|
46 { |
|
47 MUS_LOG( "mus: [ENGINE] CMusEngSession::Rect()" ) |
|
48 return iRect; |
|
49 } |
|
50 |
|
51 |
|
52 // ----------------------------------------------------------------------------- |
|
53 // |
|
54 // ----------------------------------------------------------------------------- |
|
55 // |
|
56 EXPORT_C void CMusEngSession::SetRectL( const TRect& aRect ) |
|
57 { |
|
58 MUS_LOG( "mus: [ENGINE] CMusEngSession::SetRect()" ) |
|
59 iRect = aRect; |
|
60 RectChangedL(); |
|
61 } |
|
62 |
|
63 |
|
64 // ----------------------------------------------------------------------------- |
|
65 // |
|
66 // ----------------------------------------------------------------------------- |
|
67 // |
|
68 EXPORT_C TBool CMusEngSession::AudioRoutingCanBeChanged() |
|
69 { |
|
70 return iTelephoneUtils->AudioRoutingCanBeChanged(); |
|
71 } |
|
72 |
|
73 |
|
74 // ----------------------------------------------------------------------------- |
|
75 // |
|
76 // ----------------------------------------------------------------------------- |
|
77 // |
|
78 EXPORT_C void CMusEngSession::EnableLoudspeakerL( TBool aEnable, |
|
79 TBool aShowDialog ) |
|
80 { |
|
81 TRAPD( error, iTelephoneUtils->LoudspeakerL( aEnable, aShowDialog ) ) |
|
82 |
|
83 if ( error != KErrNone ) |
|
84 { |
|
85 // This is writed for emulator use |
|
86 if ( error != KErrNotSupported ) |
|
87 { |
|
88 MUS_LOG1( "mus: [ENGINE] CMusEngSession::EnableLoudspeakerL() Leave: #%d", |
|
89 error) |
|
90 User::Leave( error ); |
|
91 } |
|
92 // Not leave in emulator if KErrNotSupported |
|
93 #if (!defined (__WINS__) && !defined(__WINSCW__)) |
|
94 User::Leave( error ); |
|
95 #endif |
|
96 } |
|
97 } |
|
98 |
|
99 |
|
100 // ----------------------------------------------------------------------------- |
|
101 // |
|
102 // ----------------------------------------------------------------------------- |
|
103 // |
|
104 EXPORT_C TBool CMusEngSession::IsLoudSpeakerEnabled() const |
|
105 { |
|
106 return iTelephoneUtils->IsLoudSpeakerEnabled(); |
|
107 } |
|
108 |
|
109 |
|
110 // ----------------------------------------------------------------------------- |
|
111 // |
|
112 // ----------------------------------------------------------------------------- |
|
113 // |
|
114 EXPORT_C TInt CMusEngSession::VolumeL() const |
|
115 { |
|
116 return iTelephoneUtils->GetVolumeL(); |
|
117 } |
|
118 |
|
119 |
|
120 // ----------------------------------------------------------------------------- |
|
121 // |
|
122 // ----------------------------------------------------------------------------- |
|
123 // |
|
124 EXPORT_C void CMusEngSession::MuteMicL( TBool aMute ) |
|
125 { |
|
126 iTelephoneUtils->MuteMicL( aMute ); |
|
127 } |
|
128 |
|
129 |
|
130 // ----------------------------------------------------------------------------- |
|
131 // |
|
132 // ----------------------------------------------------------------------------- |
|
133 // |
|
134 EXPORT_C TBool CMusEngSession::IsMicMutedL() |
|
135 { |
|
136 return iTelephoneUtils->IsMicMutedL(); |
|
137 } |
|
138 |
|
139 |
|
140 // ----------------------------------------------------------------------------- |
|
141 // |
|
142 // ----------------------------------------------------------------------------- |
|
143 // |
|
144 EXPORT_C void CMusEngSession::SetAudioRoutingObserver( |
|
145 MMusEngAudioRoutingObserver* aObserver ) |
|
146 { |
|
147 iTelephoneUtils->SetAudioRoutingObserver( aObserver ); |
|
148 } |
|
149 |
|
150 |
|
151 // ----------------------------------------------------------------------------- |
|
152 // Increases CS call volume level by one. |
|
153 // Leaves if error occurs when accessing central repository. |
|
154 // ----------------------------------------------------------------------------- |
|
155 // |
|
156 EXPORT_C void CMusEngSession::VolumeUpL( ) |
|
157 { |
|
158 TInt currentVolume = iTelephoneUtils->GetVolumeL(); |
|
159 iTelephoneUtils->SetVolumeL( currentVolume + 1 ); |
|
160 } |
|
161 |
|
162 |
|
163 // ----------------------------------------------------------------------------- |
|
164 // Decreases CS call volume level by one. |
|
165 // Leaves if error occurs when accessing central repository. |
|
166 // ----------------------------------------------------------------------------- |
|
167 // |
|
168 EXPORT_C void CMusEngSession::VolumeDownL( ) |
|
169 { |
|
170 TInt currentVolume = iTelephoneUtils->GetVolumeL(); |
|
171 iTelephoneUtils->SetVolumeL( currentVolume - 1 ); |
|
172 } |
|
173 |
|
174 // ----------------------------------------------------------------------------- |
|
175 // Set CS call volume value |
|
176 // Leaves if error occurs when accessing central repository. |
|
177 // ----------------------------------------------------------------------------- |
|
178 // |
|
179 EXPORT_C void CMusEngSession::SetVolumeL( TInt aVal ) |
|
180 { |
|
181 iTelephoneUtils->SetVolumeL( aVal ); |
|
182 } |
|
183 |
|
184 |
|
185 // ----------------------------------------------------------------------------- |
|
186 // |
|
187 // ----------------------------------------------------------------------------- |
|
188 // |
|
189 CMusEngSession::CMusEngSession( const TRect& aRect ) |
|
190 :iRect( aRect ) |
|
191 { |
|
192 } |
|
193 |
|
194 |
|
195 // ----------------------------------------------------------------------------- |
|
196 // |
|
197 // ----------------------------------------------------------------------------- |
|
198 // |
|
199 void CMusEngSession::ConstructL() // second-phase constructor |
|
200 { |
|
201 MUS_LOG( "mus: [ENGINE] -> CMusEngSession::ConstructL()" ) |
|
202 iTelephoneUtils = CMusEngTelephoneUtils::NewL(); |
|
203 MUS_LOG( "mus: [ENGINE] <- CMusEngSession::ConstructL()" ) |
|
204 } |
|
205 |
|
206 |
|