author | hgs |
Fri, 09 Jul 2010 15:40:55 +0300 | |
changeset 50 | 377c906a8701 |
parent 46 | bc5a64e5bc3c |
permissions | -rw-r--r-- |
37 | 1 |
/* |
2 |
* Copyright (c) 2002-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: This module contains the implementation of AudioData class |
|
15 |
* member functions |
|
16 |
* |
|
17 |
*/ |
|
18 |
||
19 |
// INCLUDE FILES |
|
20 |
#include "cpeaudiodata.h" |
|
21 |
||
22 |
#include <AudioPreference.h> |
|
23 |
#include <mpephonemodelinternal.h> |
|
24 |
#include <mpedatastore.h> |
|
25 |
#include <mpeexternaldatahandler.h> |
|
26 |
#include <talogger.h> |
|
27 |
#include <telmicmutestatuspskeys.h> |
|
28 |
#include <PSVariables.h> |
|
29 |
#include <tms.h> |
|
30 |
#include <tmseffectobsrvr.h> |
|
31 |
#include <tmsglobalvoleffect.h> |
|
46
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
32 |
#include <telinformationpskeys.h> |
37 | 33 |
#include "pepanic.pan" |
34 |
#include "cpeaudiodtmftoneplayer.h" |
|
35 |
#include "cpeaudioroutingmonitor.h" |
|
36 |
#include "cpecallaudioroutinghandler.h" |
|
37 |
#include "cpeaudiofactory.h" |
|
38 |
#include "cpeaudioeffect.h" |
|
39 |
||
40 |
#include <telinternalpskeys.h> |
|
41 |
||
42 |
// CONSTANTS |
|
43 |
//Mute Value for volume |
|
44 |
const TInt KPEMaxVolume = 10; |
|
45 |
||
46 |
// ================= MEMBER FUNCTIONS ======================= |
|
47 |
||
48 |
// ----------------------------------------------------------------------------- |
|
49 |
// CPEAudioData::CPEAudioData |
|
50 |
// C++ default constructor can NOT contain any code, that |
|
51 |
// might leave. |
|
52 |
// ----------------------------------------------------------------------------- |
|
53 |
// |
|
54 |
CPEAudioData::CPEAudioData(MPEPhoneModelInternal& aPhoneModel) : |
|
55 |
iPhoneModel(aPhoneModel) |
|
56 |
{ |
|
57 |
iRouteInitialized = EFalse; |
|
58 |
} |
|
59 |
||
60 |
// ----------------------------------------------------------------------------- |
|
61 |
// CPEAudioData::ConstructL |
|
62 |
// Symbian 2nd phase constructor can leave |
|
63 |
// ----------------------------------------------------------------------------- |
|
64 |
// |
|
65 |
void CPEAudioData::ConstructL(CPEAudioFactory& aAudioFactory) |
|
66 |
{ |
|
67 |
TEFLOGSTRING( KTAOBJECT, "AUD CPEAudioData::ConstructL start" ); |
|
68 |
iAudioRoutingMonitor = CPEAudioRoutingMonitor::NewL(*this); |
|
69 |
iAudioRouting = aAudioFactory.CreateTelephonyAudioRoutingL( |
|
70 |
*iAudioRoutingMonitor); |
|
71 |
iAudioRoutingHandler = CPECallAudioRoutingHandler::NewL(*this); |
|
72 |
iAudioEffect = CPEAudioEffect::NewL(*this); |
|
73 |
||
74 |
InitializeAudioVolume(); |
|
75 |
||
76 |
TEFLOGSTRING( KTAINT, "AUD CPEAudioData::ConstructL complete" ); |
|
77 |
} |
|
78 |
||
79 |
// Destructor |
|
80 |
EXPORT_C CPEAudioData::~CPEAudioData() |
|
81 |
{ |
|
82 |
TEFLOGSTRING( KTAOBJECT, "AUD CPEAudioData::~CPEAudioData" ); |
|
83 |
||
84 |
delete iAudioRouting; |
|
85 |
delete iAudioRoutingMonitor; |
|
86 |
delete iAudioRoutingHandler; |
|
87 |
||
88 |
iPEavailableOutputs.Close(); |
|
89 |
||
90 |
delete iAudioEffect; |
|
91 |
} |
|
92 |
||
93 |
// ----------------------------------------------------------------------------- |
|
94 |
// CPEAudioData::InitializeAudioVolume |
|
95 |
// Gets audio volume value |
|
96 |
// ----------------------------------------------------------------------------- |
|
97 |
// |
|
98 |
void CPEAudioData::InitializeAudioVolume() |
|
99 |
{ |
|
100 |
TInt volume = iAudioEffect->Volume(); |
|
101 |
iPhoneModel.DataStore()->SetAudioVolume(volume); |
|
102 |
||
103 |
TEFLOGSTRING2( KTAINT, |
|
104 |
"AUD CPEAudioData::InitializeAudioVolumes, volume = %d", |
|
105 |
volume ); |
|
106 |
} |
|
107 |
||
108 |
// ----------------------------------------------------------------------------- |
|
109 |
// CPEAudioData::GetAudioMuteSync |
|
110 |
// Creates synchronous request to get Audio Mute value. |
|
111 |
// (other items were commented in a header). |
|
112 |
// ----------------------------------------------------------------------------- |
|
113 |
// |
|
114 |
EXPORT_C void CPEAudioData::GetAudioMuteSync(TBool& aAudioMute) const |
|
115 |
{ |
|
116 |
aAudioMute = iAudioEffect->MuteState(); |
|
117 |
TEFLOGSTRING2( |
|
118 |
KTAREQIN, |
|
119 |
"AUD CPEAudioData::GetAudioMuteSync: value = %d", |
|
120 |
aAudioMute); |
|
121 |
||
122 |
} |
|
123 |
||
124 |
// ----------------------------------------------------------------------------- |
|
125 |
// CPEAudioData::GetAudioVolumeSync |
|
126 |
// Creates synchronous request to get audio volume. |
|
127 |
// ----------------------------------------------------------------------------- |
|
128 |
// |
|
129 |
EXPORT_C void CPEAudioData::GetAudioVolumeSync(TInt& aAudioVolume) const |
|
130 |
{ |
|
131 |
TEFLOGSTRING( KTAINT, "AUD CPEAudioData::GetAudioVolumeSync" ); |
|
132 |
aAudioVolume = iAudioEffect->Volume(); |
|
133 |
} |
|
134 |
||
135 |
// ----------------------------------------------------------------------------- |
|
136 |
// CPEAudioData::SendErrorMessage |
|
137 |
// Saves errorcode to member variable and sends error notification to PhoneEngine. |
|
138 |
// ----------------------------------------------------------------------------- |
|
139 |
// |
|
140 |
void CPEAudioData::SendErrorMessage(const TInt aErrorCode) |
|
141 |
{ |
|
142 |
iPhoneModel.DataStore()->SetErrorCode(aErrorCode); |
|
143 |
TEFLOGSTRING( |
|
144 |
KTAREQOUT, |
|
145 |
"AUD CPEAudioData::SendErrorMessage: iPhoneModel.SendMessage( MEngineMonitor::EPEMessageAudioHandlingError )" ); |
|
146 |
iPhoneModel.SendMessage(MEngineMonitor::EPEMessageAudioHandlingError); |
|
147 |
} |
|
148 |
||
149 |
// ----------------------------------------------------------------------------- |
|
150 |
// CPEAudioData::SendMessage |
|
151 |
// Forwards message to PhoneEngine. |
|
152 |
// ----------------------------------------------------------------------------- |
|
153 |
// |
|
154 |
void CPEAudioData::SendMessage( |
|
155 |
const MEngineMonitor::TPEMessagesFromPhoneEngine aMessage) |
|
156 |
{ |
|
157 |
TEFLOGSTRING2( KTAREQIN, |
|
158 |
"AUD CPEAudioData::SendMessage: aMessage = %d", aMessage ); |
|
159 |
||
160 |
if (aMessage == MEngineMonitor::EPEMessageAudioVolumeChanged) |
|
161 |
{ |
|
162 |
// update volume |
|
163 |
TInt volume = iPhoneModel.DataStore()->AudioVolume(); |
|
164 |
TEFLOGSTRING2( KTAINT, |
|
165 |
"AUD CPEAudioData::SendMessage: volume = %d", |
|
166 |
volume ); |
|
167 |
} |
|
168 |
||
169 |
iPhoneModel.SendMessage(aMessage); |
|
170 |
} |
|
171 |
||
172 |
// ----------------------------------------------------------------------------- |
|
173 |
// CPEAudioData::SendMessage |
|
174 |
// Forwards message to PhoneEngine. Output mode is saved. |
|
175 |
// ----------------------------------------------------------------------------- |
|
176 |
// |
|
177 |
void CPEAudioData::SendMessage( |
|
178 |
const MEngineMonitor::TPEMessagesFromPhoneEngine aMessage, |
|
179 |
const CTelephonyAudioRouting::TAudioOutput aOutput) |
|
180 |
{ |
|
181 |
TEFLOGSTRING3( |
|
182 |
KTAREQIN, |
|
183 |
"AUD CPEAudioData::SendMessage: aMessage = %d, aOutput = %d", |
|
184 |
aMessage, aOutput ); |
|
185 |
||
186 |
// BT long key press requires manual re-route to handset or loudspeaker |
|
187 |
if (aOutput == CTelephonyAudioRouting::ENone |
|
188 |
&& iAudioRouting->PreviousOutput() |
|
189 |
== CTelephonyAudioRouting::EBTAudioAccessory) |
|
190 |
{ |
|
191 |
SetRoutePreference(ETrue); |
|
192 |
} |
|
193 |
else |
|
194 |
{ |
|
195 |
// update the audio values in engineinfo |
|
196 |
TBool status; |
|
197 |
iAudioRouting->GetShowNote(status); |
|
198 |
iPhoneModel.DataStore()->SetAudioOutput(ConvertToPE(aOutput), |
|
199 |
ConvertToPE(PreviousOutput()), status); |
|
200 |
iPhoneModel.SendMessage(aMessage); |
|
201 |
} |
|
202 |
} |
|
203 |
||
204 |
// ----------------------------------------------------------------------------- |
|
205 |
// CPEAudioData::SendMessage |
|
206 |
// Forwards message to PhoneEngine. |
|
207 |
// ----------------------------------------------------------------------------- |
|
208 |
// |
|
209 |
void CPEAudioData::SendMessage( |
|
210 |
const MEngineMonitor::TPEMessagesFromPhoneEngine aMessage, |
|
211 |
CTelephonyAudioRouting& aTelephonyAudioRouting) |
|
212 |
{ |
|
213 |
TEFLOGSTRING2( |
|
214 |
KTAREQIN, |
|
215 |
"AUD CPEAudioData::SendMessage: aMessage = %d, available outputs changed ", aMessage ); |
|
216 |
iPhoneModel.DataStore()->SetAvailableAudioOutputs(GetAvailableOutputs( |
|
217 |
aTelephonyAudioRouting)); |
|
218 |
||
219 |
if (iRouteInitialized && aMessage |
|
220 |
== MEngineMonitor::EPEMessageAvailableAudioOutputsChanged) |
|
221 |
{ |
|
222 |
iAudioRoutingHandler->HandleAudioRoutingAvailableChanged(); |
|
223 |
} |
|
224 |
||
225 |
iPhoneModel.SendMessage(aMessage); |
|
226 |
} |
|
227 |
||
228 |
// ----------------------------------------------------------------------------- |
|
229 |
// CPEAudioData::SetAudioMuteSync |
|
230 |
// Creates synchronous request to set audio mute. |
|
231 |
// EPEMessageAudioMuteChanged message is sent when gain is changed |
|
232 |
// ----------------------------------------------------------------------------- |
|
233 |
// |
|
234 |
EXPORT_C void CPEAudioData::SetAudioMuteSync(const TBool aAudioMute) // Mute value to be set |
|
235 |
{ |
|
236 |
TEFLOGSTRING( KTAINT, "AUD CPEAudioData::SetAudioMuteSync" ); |
|
237 |
||
238 |
if (aAudioMute) |
|
239 |
{ |
|
240 |
iPhoneModel.DataStore()->SetAudioMute(aAudioMute); |
|
241 |
SendMessage(MEngineMonitor::EPEMessageAudioMuteChanged); |
|
242 |
TInt err = iAudioEffect->SetMuteState(ETrue); |
|
243 |
TEFLOGSTRING2( |
|
244 |
KTAREQOUT, |
|
245 |
"AUD CPEAudioData::SetAudioMuteSync: error = %d", |
|
246 |
err ); |
|
247 |
} |
|
248 |
else |
|
249 |
{ |
|
250 |
iPhoneModel.DataStore()->SetAudioMute(aAudioMute); |
|
251 |
SendMessage(MEngineMonitor::EPEMessageAudioMuteChanged); |
|
252 |
TInt err = iAudioEffect->SetMuteState(EFalse); |
|
253 |
TEFLOGSTRING2( |
|
254 |
KTAREQOUT, |
|
255 |
"AUD CPEAudioData::SetAudioMuteSync: error = %d", |
|
256 |
err ); |
|
257 |
} |
|
258 |
} |
|
259 |
||
260 |
// ----------------------------------------------------------------------------- |
|
261 |
// CPEAudioData::SetAudioVolumeSync |
|
262 |
// Creates synchronous request to set audio volume. |
|
263 |
// ----------------------------------------------------------------------------- |
|
264 |
// |
|
265 |
EXPORT_C void CPEAudioData::SetAudioVolumeSync(const TInt aAudioVolume) // Volume to be set |
|
266 |
{ |
|
267 |
TEFLOGSTRING2( |
|
268 |
KTAREQIN, |
|
269 |
"AUD CPEAudioData::SetAudioVolumeSync, aAudioVolume = %d", |
|
270 |
aAudioVolume ); |
|
271 |
||
272 |
if (aAudioVolume <= KPEMaxVolume) |
|
273 |
{ |
|
274 |
TEFLOGSTRING2( KTAINT, |
|
275 |
"AUD CPEAudioData::SetAudioVolumeSync, aAudioVolume = %d", |
|
276 |
aAudioVolume ); |
|
277 |
||
278 |
iAudioEffect->SetVolume(aAudioVolume); |
|
279 |
} |
|
280 |
DoHandleVolumeChange(aAudioVolume, ETrue); |
|
281 |
} |
|
282 |
||
283 |
// ----------------------------------------------------------------------------- |
|
284 |
// CPEAudioData::SetAudioOutput |
|
285 |
// Makes request to Telephony Audio Routing to set audio output path |
|
286 |
// ----------------------------------------------------------------------------- |
|
287 |
// |
|
288 |
EXPORT_C TInt CPEAudioData::SetAudioOutput(const TPEAudioOutput aOutput, |
|
289 |
TBool aShowNote) |
|
290 |
{ |
|
291 |
TEFLOGSTRING2( |
|
292 |
KTAREQIN, |
|
293 |
"AUD CPEAudioData::SetAudioOutput: aOutput = %d", |
|
294 |
aOutput ); |
|
295 |
||
296 |
TInt error(KErrNone); |
|
297 |
||
298 |
TEFLOGSTRING2( KTAERROR, |
|
299 |
"AUD CPEAudioData::SetAudioOutput: iRouteInitialized (%d)" |
|
300 |
, iRouteInitialized ); |
|
301 |
||
302 |
if (iRouteInitialized && iPhoneModel.DataStore()->AudioOutputAvailable( |
|
303 |
aOutput)) |
|
304 |
{ |
|
305 |
SetTAROutput(ConvertToTAR(aOutput), aShowNote); |
|
306 |
} |
|
307 |
else |
|
308 |
{ |
|
309 |
if (aOutput == EPEHandset) |
|
310 |
{ |
|
311 |
iAudioRoutingHandler->SetAnswerToHandset(ETrue); |
|
312 |
} |
|
313 |
else |
|
314 |
{ |
|
315 |
TEFLOGSTRING2( KTAERROR, |
|
316 |
"AUD CPEAudioData::SetAudioOutput: Requested audio path not available (%d)" |
|
317 |
, aOutput ); |
|
318 |
error = KErrArgument; |
|
319 |
} |
|
320 |
} |
|
321 |
||
322 |
return error; |
|
323 |
} |
|
324 |
||
325 |
// ----------------------------------------------------------------------------- |
|
326 |
// CPEAudioData::SetTAROutput |
|
327 |
// ----------------------------------------------------------------------------- |
|
328 |
// |
|
329 |
void CPEAudioData::SetTAROutput(CTelephonyAudioRouting::TAudioOutput aOutput, |
|
330 |
TBool aShowNote) |
|
331 |
{ |
|
332 |
TEFLOGSTRING2( |
|
333 |
KTAREQIN, |
|
334 |
"AUD CPEAudioData::SetTAROutput: aOutput = %d", |
|
335 |
aOutput ); |
|
336 |
||
337 |
#if defined(__WINSCW__ ) && !defined(UNIT_TESTING) |
|
338 |
iAudioRouting->SetShowNote(aShowNote); |
|
339 |
SendMessage(MEngineMonitor::EPEMessageAudioOutputChanged, aOutput); |
|
340 |
#else |
|
341 |
CTelephonyAudioRouting::TAudioOutput output = iAudioRouting->Output(); |
|
342 |
||
343 |
if ( output == aOutput ) |
|
344 |
{ |
|
345 |
// audio routing cannot changed |
|
346 |
TEFLOGSTRING2( KTAERROR, |
|
347 |
"AUD CPEAudioData::SetTAROutput: audio path already (%d)" |
|
348 |
, aOutput ); |
|
349 |
return; |
|
350 |
} |
|
351 |
iAudioRouting->SetShowNote( aShowNote ); |
|
352 |
TRAPD( err, iAudioRouting->SetOutputL( aOutput ) ); |
|
353 |
||
354 |
if( err ) |
|
355 |
{ |
|
356 |
TEFLOGSTRING2( KTAERROR, |
|
357 |
"AUD CPEAudioData::SetTAROutput:Leave.1 (%d)", err ); |
|
358 |
switch ( aOutput ) |
|
359 |
{ |
|
360 |
case CTelephonyAudioRouting::ELoudspeaker: |
|
361 |
case CTelephonyAudioRouting::EWiredAudioAccessory: |
|
362 |
case CTelephonyAudioRouting::EBTAudioAccessory: |
|
363 |
// if leave try handset |
|
364 |
TRAPD( err2, iAudioRouting->SetOutputL( CTelephonyAudioRouting::EHandset ) ); |
|
365 |
if( err2 ) |
|
366 |
{ |
|
367 |
TEFLOGSTRING2( KTAERROR, |
|
368 |
"AUD CPEAudioData::SetTAROutput:Leave.2 (%d)", err ); |
|
369 |
} |
|
370 |
break; |
|
371 |
default: |
|
372 |
// None |
|
373 |
break; |
|
374 |
} |
|
375 |
} |
|
376 |
#endif |
|
377 |
} |
|
378 |
||
379 |
// ----------------------------------------------------------------------------- |
|
380 |
// CPEAudioData::StartUp |
|
381 |
// Gets initial values and inializes TAR |
|
382 |
// StartUpL methods. |
|
383 |
// ----------------------------------------------------------------------------- |
|
384 |
// |
|
385 |
EXPORT_C void CPEAudioData::StartUp() |
|
386 |
{ |
|
387 |
TEFLOGSTRING( KTAREQIN, "AUD CPEAudioData::StartUp" ); |
|
388 |
// get available audio output paths and current audio output |
|
389 |
iPhoneModel.DataStore()->SetAvailableAudioOutputs(GetAvailableOutputs( |
|
390 |
*iAudioRouting)); |
|
391 |
iPhoneModel.DataStore()->SetAudioOutput(ConvertToPE( |
|
392 |
iAudioRouting->Output()), ConvertToPE( |
|
393 |
iAudioRouting->PreviousOutput()), EFalse); |
|
394 |
} |
|
395 |
||
396 |
// ----------------------------------------------------------------------------- |
|
397 |
// CPEAudioData::GetAvailableOutputs |
|
398 |
// Gets Available Outputs from Audio routing framework |
|
399 |
// Return list of available outputs |
|
400 |
// ----------------------------------------------------------------------------- |
|
401 |
// |
|
402 |
TArray<TPEAudioOutput> CPEAudioData::GetAvailableOutputs( |
|
403 |
CTelephonyAudioRouting& aTelephonyAudioRouting) |
|
404 |
{ |
|
405 |
TEFLOGSTRING( KTAREQOUT, |
|
406 |
"AUD CPEAudioData::GetAvailableOutputs > CTelephonyAudioRouting::AvailableOutputs()" ); |
|
407 |
TArray<CTelephonyAudioRouting::TAudioOutput> availableOutputs = |
|
408 |
aTelephonyAudioRouting.AvailableOutputs(); |
|
409 |
||
410 |
iPEavailableOutputs.Reset(); |
|
411 |
||
412 |
for (TInt j = 0; j < availableOutputs.Count(); j++) |
|
413 |
{ |
|
50 | 414 |
TInt err = iPEavailableOutputs.Append(ConvertToPE(availableOutputs[j])); |
415 |
TEFLOGSTRING4( KTAINT, |
|
416 |
"AUD CPEAudioData::GetAvailableOutputs, index: %d, available: %d, err: %d", |
|
37 | 417 |
j, |
50 | 418 |
availableOutputs[j], |
419 |
err ); |
|
420 |
if(err != KErrNone) |
|
421 |
{ |
|
422 |
// Do nothing. Here for just to suppress the compile warning. |
|
423 |
} |
|
37 | 424 |
} |
425 |
||
426 |
return iPEavailableOutputs.Array(); |
|
427 |
} |
|
428 |
||
429 |
// ----------------------------------------------------------------------------- |
|
430 |
// CPEAudioData::HandleCallStarting |
|
431 |
// ----------------------------------------------------------------------------- |
|
432 |
// |
|
433 |
EXPORT_C TInt CPEAudioData::HandleCallStarting(TBool aVideoCall) |
|
434 |
{ |
|
435 |
TEFLOGSTRING( KTAMESINT, "AUD CPEAudioData::HandleCallStarting()" ); |
|
436 |
TInt ret(KErrNone); |
|
437 |
||
438 |
if (!iRouteInitialized) // if route not already initialized |
|
439 |
{ // Not new route init for multi calls |
|
440 |
iRouteInitialized = ETrue; |
|
441 |
ret = iAudioRoutingHandler->HandleAudioRoutingCallInit(aVideoCall); |
|
442 |
} |
|
443 |
||
444 |
return ret; |
|
445 |
} |
|
446 |
||
447 |
// ----------------------------------------------------------------------------- |
|
448 |
// CPEAudioData::HandleEnergencyCallStarting |
|
449 |
// Can be called, if new call is created before previous call is idle state |
|
450 |
// One used situation is that emergency call is dialed during the video call or |
|
451 |
// voice call. Audio routing have to initialized when emergency is dialing state |
|
452 |
// even previous call(voice or video) haven't got idle yet. |
|
453 |
// ----------------------------------------------------------------------------- |
|
454 |
// |
|
455 |
EXPORT_C TInt CPEAudioData::HandleEnergencyCallStarting() |
|
456 |
{ |
|
457 |
TEFLOGSTRING( KTAMESINT, "AUD CPEAudioData::HandleCallSwitching()" ); |
|
458 |
TInt ret(KErrNone); |
|
459 |
||
460 |
// Always new route init |
|
461 |
ret = iAudioRoutingHandler->HandleAudioRoutingCallInit(EFalse); |
|
462 |
iRouteInitialized = ETrue; |
|
463 |
||
464 |
return ret; |
|
465 |
} |
|
466 |
||
467 |
// ----------------------------------------------------------------------------- |
|
468 |
// CPEAudioData::HandleCallEnding() |
|
469 |
// ----------------------------------------------------------------------------- |
|
470 |
// |
|
471 |
EXPORT_C void CPEAudioData::HandleCallEnding() |
|
472 |
{ |
|
473 |
TEFLOGSTRING( KTAMESINT, "AUD CPEAudioData::HandleCallEnding()" ); |
|
474 |
||
475 |
if (iRouteInitialized) |
|
476 |
{ |
|
477 |
iRouteInitialized = EFalse; |
|
478 |
TEFLOGSTRING( KTAMESINT, |
|
479 |
"AUD CPEAudioData::HandleCallEnding() > CTelephonyAudioRouting::ENotActive" ); |
|
480 |
SetTAROutput(CTelephonyAudioRouting::ENotActive, EFalse); |
|
481 |
} |
|
482 |
} |
|
483 |
||
484 |
// ----------------------------------------------------------------------------- |
|
485 |
// CPEAudioData::CallAudioRoutePreferenceChanged() |
|
486 |
// |
|
487 |
// ----------------------------------------------------------------------------- |
|
488 |
// |
|
489 |
EXPORT_C TInt CPEAudioData::CallAudioRoutePreferenceChanged() |
|
490 |
{ |
|
491 |
TEFLOGSTRING( KTAMESINT, "AUD CPEAudioData::CallAudioRoutePreferenceChanged()" ); |
|
492 |
if (iRouteInitialized) |
|
493 |
{ |
|
494 |
return iAudioRoutingHandler->HandleAudioRoutePreferenceChanged(); |
|
495 |
} |
|
496 |
return KErrNotReady; |
|
497 |
} |
|
498 |
||
499 |
// ----------------------------------------------------------------------------- |
|
500 |
// CPEAudioData::PreviousOutput |
|
501 |
// ----------------------------------------------------------------------------- |
|
502 |
// |
|
503 |
CTelephonyAudioRouting::TAudioOutput CPEAudioData::PreviousOutput() |
|
504 |
{ |
|
505 |
return iAudioRouting->PreviousOutput(); |
|
506 |
} |
|
507 |
||
508 |
// ----------------------------------------------------------------------------- |
|
509 |
// CPEAudioData::Output |
|
510 |
// ----------------------------------------------------------------------------- |
|
511 |
// |
|
512 |
CTelephonyAudioRouting::TAudioOutput CPEAudioData::Output() |
|
513 |
{ |
|
514 |
return iAudioRouting->Output(); |
|
515 |
} |
|
516 |
||
517 |
// ----------------------------------------------------------------------------- |
|
518 |
// CPEAudioData::SetRoutePreference |
|
519 |
// ----------------------------------------------------------------------------- |
|
520 |
// |
|
521 |
void CPEAudioData::SetRoutePreference(TBool aShowNote) |
|
522 |
{ |
|
523 |
TEFLOGSTRING( KTAMESINT, "AUD CPEAudioData::SetRoutePreference()" ); |
|
524 |
CTelephonyAudioRouting::TAudioOutput output = |
|
525 |
CTelephonyAudioRouting::EHandset; |
|
526 |
||
527 |
const TInt outputPreference = |
|
528 |
iPhoneModel.DataStore()->AudioOutputPreference(); |
|
529 |
if (outputPreference == EPSAudioPublic) |
|
530 |
{ |
|
531 |
output = CTelephonyAudioRouting::ELoudspeaker; |
|
532 |
} |
|
533 |
TInt error; |
|
534 |
iAudioRouting->SetShowNote(aShowNote); |
|
535 |
TRAP( error, iAudioRouting->SetOutputL( output ) ); |
|
536 |
TEFLOGSTRING2( KTAMESINT, "AUD CPEAudioData::SetRoutePreference() err %d", error ); |
|
537 |
} |
|
538 |
||
539 |
// ----------------------------------------------------------------------------- |
|
540 |
// CPEAudioData::RoutePreference |
|
541 |
// ----------------------------------------------------------------------------- |
|
542 |
// |
|
543 |
CTelephonyAudioRouting::TAudioOutput CPEAudioData::RoutePreference() |
|
544 |
{ |
|
545 |
CTelephonyAudioRouting::TAudioOutput output = |
|
546 |
CTelephonyAudioRouting::EHandset; |
|
547 |
||
548 |
const TInt outputPreference = |
|
549 |
iPhoneModel.DataStore()->AudioOutputPreference(); |
|
550 |
if (outputPreference == EPSAudioPublic) |
|
551 |
{ |
|
552 |
output = CTelephonyAudioRouting::ELoudspeaker; |
|
553 |
} |
|
46
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
554 |
else |
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
555 |
{ |
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
556 |
TInt value; |
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
557 |
const TInt err = RProperty::Get( KPSUidTelCarMode, KTelCarMode, value ); |
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
558 |
if ( !err && value == EPSCarModeOn ) |
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
559 |
{ |
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
560 |
output = CTelephonyAudioRouting::ELoudspeaker; |
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
561 |
} |
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
562 |
} |
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
563 |
|
37 | 564 |
TEFLOGSTRING2( KTAMESINT, "AUD CPEAudioData::RoutePreference() output %d", output ); |
565 |
return output; |
|
566 |
} |
|
567 |
// ----------------------------------------------------------------------------- |
|
568 |
// CPEAudioData::IsWiredAvailable |
|
569 |
// ----------------------------------------------------------------------------- |
|
570 |
// |
|
571 |
TBool CPEAudioData::IsWiredAvailable() |
|
572 |
{ |
|
573 |
return iPhoneModel.DataStore()->AudioOutputAvailable( |
|
574 |
EPEWiredAudioAccessory); |
|
575 |
} |
|
576 |
||
577 |
// ----------------------------------------------------------------------------- |
|
578 |
// CPEAudioData::IsBTAvailable |
|
579 |
// ----------------------------------------------------------------------------- |
|
580 |
// |
|
581 |
TBool CPEAudioData::IsBTAvailable() |
|
582 |
{ |
|
583 |
return iPhoneModel.DataStore()->AudioOutputAvailable(EPEBTAudioAccessory); |
|
584 |
} |
|
585 |
||
586 |
// ----------------------------------------------------------------------------- |
|
587 |
// CPEAudioData::IsTTYAvailable |
|
588 |
// ----------------------------------------------------------------------------- |
|
589 |
// |
|
590 |
TBool CPEAudioData::IsTTYAvailable() |
|
591 |
{ |
|
592 |
return iPhoneModel.DataStore()->AudioOutputAvailable(EPETTY); |
|
593 |
} |
|
594 |
||
595 |
// ----------------------------------------------------------------------------- |
|
596 |
// CPEAudioData::ConvertToPE |
|
597 |
// ----------------------------------------------------------------------------- |
|
598 |
// |
|
599 |
TPEAudioOutput CPEAudioData::ConvertToPE( |
|
600 |
CTelephonyAudioRouting::TAudioOutput aOutput) |
|
601 |
{ |
|
602 |
TEFLOGSTRING2( KTAMESINT, "AUD CPEAudioData::ConvertToPE, aOutput %d", aOutput ); |
|
603 |
TPEAudioOutput newOutput(EPENotActive); |
|
604 |
||
605 |
switch (aOutput) |
|
606 |
{ |
|
607 |
case CTelephonyAudioRouting::ENotActive: |
|
608 |
newOutput = EPENotActive; |
|
609 |
break; |
|
610 |
case CTelephonyAudioRouting::EHandset: |
|
611 |
newOutput = EPEHandset; |
|
612 |
break; |
|
613 |
case CTelephonyAudioRouting::ELoudspeaker: |
|
614 |
newOutput = EPELoudspeaker; |
|
615 |
break; |
|
616 |
case CTelephonyAudioRouting::EWiredAudioAccessory: |
|
617 |
newOutput = EPEWiredAudioAccessory; |
|
618 |
break; |
|
619 |
case CTelephonyAudioRouting::EBTAudioAccessory: |
|
620 |
newOutput = EPEBTAudioAccessory; |
|
621 |
break; |
|
622 |
case CTelephonyAudioRouting::ETTY: |
|
623 |
newOutput = EPETTY; |
|
624 |
break; |
|
625 |
default: |
|
626 |
break; |
|
627 |
} |
|
628 |
||
629 |
return newOutput; |
|
630 |
} |
|
631 |
||
632 |
// ----------------------------------------------------------------------------- |
|
633 |
// CPEAudioData::ConvertToTAR |
|
634 |
// ----------------------------------------------------------------------------- |
|
635 |
// |
|
636 |
CTelephonyAudioRouting::TAudioOutput CPEAudioData::ConvertToTAR( |
|
637 |
TPEAudioOutput aOutput) |
|
638 |
{ |
|
639 |
TEFLOGSTRING2( KTAMESINT, "AUD CPEAudioData::ConvertToTAR, aOutput %d", aOutput ); |
|
640 |
||
641 |
CTelephonyAudioRouting::TAudioOutput newOutput( |
|
642 |
CTelephonyAudioRouting::ENotActive); |
|
643 |
||
644 |
switch (aOutput) |
|
645 |
{ |
|
646 |
case EPENotActive: |
|
647 |
newOutput = CTelephonyAudioRouting::ENotActive; |
|
648 |
break; |
|
649 |
case EPEHandset: |
|
650 |
newOutput = CTelephonyAudioRouting::EHandset; |
|
651 |
break; |
|
652 |
case EPELoudspeaker: |
|
653 |
newOutput = CTelephonyAudioRouting::ELoudspeaker; |
|
654 |
break; |
|
655 |
case EPEWiredAudioAccessory: |
|
656 |
newOutput = CTelephonyAudioRouting::EWiredAudioAccessory; |
|
657 |
break; |
|
658 |
case EPEBTAudioAccessory: |
|
659 |
newOutput = CTelephonyAudioRouting::EBTAudioAccessory; |
|
660 |
break; |
|
661 |
case EPETTY: |
|
662 |
newOutput = CTelephonyAudioRouting::ETTY; |
|
663 |
break; |
|
664 |
default: |
|
665 |
break; |
|
666 |
} |
|
667 |
return newOutput; |
|
668 |
} |
|
669 |
||
670 |
// ----------------------------------------------------------------------------- |
|
671 |
// CPEAudioData::DoHandleVolumeChange |
|
672 |
// ----------------------------------------------------------------------------- |
|
673 |
// |
|
674 |
void CPEAudioData::DoHandleVolumeChange(TInt aVolume, TBool aSendMsg) |
|
675 |
{ |
|
676 |
iPhoneModel.DataStore()->SetAudioVolume(aVolume); |
|
677 |
||
678 |
if (aSendMsg) |
|
679 |
{ |
|
680 |
SendMessage(MEngineMonitor::EPEMessageAudioVolumeChanged); |
|
681 |
} |
|
682 |
} |
|
683 |
||
684 |
// ----------------------------------------------------------------------------- |
|
685 |
// CPEAudioData::EffectsEvent |
|
686 |
// ----------------------------------------------------------------------------- |
|
687 |
// |
|
688 |
void CPEAudioData::EffectsEvent(const TMSEffect& tmseffect, |
|
689 |
TMSSignalEvent event) |
|
690 |
{ |
|
691 |
TMSEffectType effecttype; |
|
692 |
const_cast<TMSEffect&>(tmseffect).GetType(effecttype); |
|
693 |
||
694 |
if (effecttype == TMS_EFFECT_GLOBAL_VOL && |
|
695 |
event.type == TMS_EVENT_EFFECT_VOL_CHANGED) |
|
696 |
{ |
|
697 |
TMSVolumeEventChangeData* vd; |
|
698 |
vd = static_cast<TMSVolumeEventChangeData*>(event.event_data); |
|
699 |
||
700 |
// If volume change event has been triggered by routing change, we |
|
701 |
// do not want to send EPEMessageAudioVolumeChanged message. |
|
702 |
if (!vd->output_changed) |
|
703 |
{ |
|
704 |
DoHandleVolumeChange(iAudioEffect->Volume(), ETrue); |
|
705 |
} |
|
706 |
else |
|
707 |
{ |
|
708 |
DoHandleVolumeChange(iAudioEffect->Volume(), EFalse); |
|
709 |
} |
|
710 |
} |
|
711 |
} |
|
712 |
||
713 |
// End of File |