30 |
30 |
31 #include "pepanic.pan" |
31 #include "pepanic.pan" |
32 #include "cpeaudiodtmftoneplayer.h" |
32 #include "cpeaudiodtmftoneplayer.h" |
33 #include "cpeaudioroutingmonitor.h" |
33 #include "cpeaudioroutingmonitor.h" |
34 #include "cpecallaudioroutinghandler.h" |
34 #include "cpecallaudioroutinghandler.h" |
35 #include "cpeaudiofactory.h" |
35 #include "cpeaudiofactory.h" |
36 #include <telinternalpskeys.h> |
36 #include <telinternalpskeys.h> |
37 // CONSTANTS |
37 // CONSTANTS |
38 //Mute Value for volume |
38 //Mute Value for volume |
39 const TInt KPEDefaultVolume = 4; |
39 const TInt KPEDefaultVolume = 4; |
40 const TInt KPEMaxVolume = 10; |
40 const TInt KPEMaxVolume = 10; |
71 InitializeAudioVolumes(); |
71 InitializeAudioVolumes(); |
72 |
72 |
73 RProperty::TType type( RProperty::EInt ); |
73 RProperty::TType type( RProperty::EInt ); |
74 TSecurityPolicy readPolicy( ECapability_None ); |
74 TSecurityPolicy readPolicy( ECapability_None ); |
75 TSecurityPolicy writePolicy( ECapabilityWriteDeviceData ); |
75 TSecurityPolicy writePolicy( ECapabilityWriteDeviceData ); |
76 |
76 |
77 RProperty::Define( KPSUidTelMicrophoneMuteStatus, |
77 RProperty::Define( KPSUidTelMicrophoneMuteStatus, |
78 KTelMicrophoneMuteState, |
78 KTelMicrophoneMuteState, |
79 type, |
79 type, |
80 readPolicy, |
80 readPolicy, |
81 writePolicy ); |
81 writePolicy ); |
194 { |
194 { |
195 TEFLOGSTRING2( KTAREQIN, |
195 TEFLOGSTRING2( KTAREQIN, |
196 "AUD CPEAudioData::SendMessage: aMessage = %d", aMessage ); |
196 "AUD CPEAudioData::SendMessage: aMessage = %d", aMessage ); |
197 |
197 |
198 if ( aMessage == MEngineMonitor::EPEMessageAudioVolumeChanged ) |
198 if ( aMessage == MEngineMonitor::EPEMessageAudioVolumeChanged ) |
199 { |
199 { |
200 // update volume |
200 // update volume |
201 if ( iPhoneModel.DataStore()->AudioOutput() == EPELoudspeaker ) |
201 if ( iPhoneModel.DataStore()->AudioOutput() == EPELoudspeaker ) |
202 { |
202 { |
203 iLoudspeakerVolume = iPhoneModel.DataStore()->AudioVolume(); |
203 iLoudspeakerVolume = iPhoneModel.DataStore()->AudioVolume(); |
204 TEFLOGSTRING2( KTAINT, |
204 TEFLOGSTRING2( KTAINT, |
205 "AUD CPEAudioData::SendMessage: iLoudspeakerVolume = %d", |
205 "AUD CPEAudioData::SendMessage: iLoudspeakerVolume = %d", |
206 iLoudspeakerVolume ); |
206 iLoudspeakerVolume ); |
207 } |
207 } |
208 else |
208 else |
209 { |
209 { |
210 iHeadSetVolume = iPhoneModel.DataStore()->AudioVolume(); |
210 iHeadSetVolume = iPhoneModel.DataStore()->AudioVolume(); |
211 TEFLOGSTRING2( KTAINT, |
211 TEFLOGSTRING2( KTAINT, |
212 "AUD CPEAudioData::SendMessage: iHeadSetVolume = %d", |
212 "AUD CPEAudioData::SendMessage: iHeadSetVolume = %d", |
213 iHeadSetVolume ); |
213 iHeadSetVolume ); |
214 } |
214 } |
215 |
215 |
216 if ( !iAudioOutputChanged ) |
216 if ( !iAudioOutputChanged ) |
217 { |
217 { |
218 // EPEMessageAudioVolumeChanged message must not be sent |
218 // EPEMessageAudioVolumeChanged message must not be sent |
219 // while audio output change is being processed |
219 // while audio output change is being processed |
220 iPhoneModel.SendMessage( aMessage ); |
220 iPhoneModel.SendMessage( aMessage ); |
221 } |
221 } |
222 } |
222 } |
223 else |
223 else |
224 { |
224 { |
225 iPhoneModel.SendMessage( aMessage ); |
225 iPhoneModel.SendMessage( aMessage ); |
226 } |
226 } |
227 } |
227 } |
228 |
228 |
229 // ----------------------------------------------------------------------------- |
229 // ----------------------------------------------------------------------------- |
230 // CPEAudioData::SendMessage |
230 // CPEAudioData::SendMessage |
400 EPEIncallEarVolumeSetting, |
400 EPEIncallEarVolumeSetting, |
401 aAudioVolume ); |
401 aAudioVolume ); |
402 TEFLOGSTRING( KTAINT, |
402 TEFLOGSTRING( KTAINT, |
403 "AUD CPEAudioData::SetAudioVolumeSync: EPEIncallEarVolumeSetting"); |
403 "AUD CPEAudioData::SetAudioVolumeSync: EPEIncallEarVolumeSetting"); |
404 } |
404 } |
405 } |
405 } |
406 |
406 |
407 iPhoneModel.DataStore()->SetAudioVolume( aAudioVolume ); |
407 iPhoneModel.DataStore()->SetAudioVolume( aAudioVolume ); |
408 |
408 |
409 DoHandleVolumeChange( aAudioVolume ); |
409 DoHandleVolumeChange( aAudioVolume ); |
410 |
410 |
468 aOutput ); |
468 aOutput ); |
469 |
469 |
470 #if defined(__WINSCW__ ) && !defined(UNIT_TESTING) |
470 #if defined(__WINSCW__ ) && !defined(UNIT_TESTING) |
471 iAudioRouting->SetShowNote( aShowNote ); |
471 iAudioRouting->SetShowNote( aShowNote ); |
472 SendMessage( MEngineMonitor::EPEMessageAudioOutputChanged, aOutput); |
472 SendMessage( MEngineMonitor::EPEMessageAudioOutputChanged, aOutput); |
473 #else |
473 #else |
474 CTelephonyAudioRouting::TAudioOutput output = iAudioRouting->Output(); |
474 CTelephonyAudioRouting::TAudioOutput output = iAudioRouting->Output(); |
475 |
475 |
476 if ( output == aOutput ) |
476 if ( output == aOutput ) |
477 { |
477 { |
478 // audio routing cannot changed |
478 // audio routing cannot changed |
479 TEFLOGSTRING2( KTAERROR, |
479 TEFLOGSTRING2( KTAERROR, |
480 "AUD CPEAudioData::SetTAROutput: audio path already (%d)" |
480 "AUD CPEAudioData::SetTAROutput: audio path already (%d)" |
481 , aOutput ); |
481 , aOutput ); |
482 return; |
482 return; |
483 } |
483 } |
484 iAudioRouting->SetShowNote( aShowNote ); |
484 iAudioRouting->SetShowNote( aShowNote ); |
485 TRAPD( err, iAudioRouting->SetOutputL( aOutput ) ); |
485 TRAPD( err, iAudioRouting->SetOutputL( aOutput ) ); |
486 |
486 |
487 if( err ) |
487 if( err ) |
488 { |
488 { |
489 TEFLOGSTRING2( KTAERROR, |
489 TEFLOGSTRING2( KTAERROR, |
490 "AUD CPEAudioData::SetTAROutput:Leave.1 (%d)", err ); |
490 "AUD CPEAudioData::SetTAROutput:Leave.1 (%d)", err ); |
491 switch ( aOutput ) |
491 switch ( aOutput ) |
492 { |
492 { |
493 case CTelephonyAudioRouting::ELoudspeaker: |
493 case CTelephonyAudioRouting::ELoudspeaker: |
494 case CTelephonyAudioRouting::EWiredAudioAccessory: |
494 case CTelephonyAudioRouting::EWiredAudioAccessory: |
495 case CTelephonyAudioRouting::EBTAudioAccessory: |
495 case CTelephonyAudioRouting::EBTAudioAccessory: |
496 // if leave try handset |
496 // if leave try handset |
497 TRAPD( err2, iAudioRouting->SetOutputL( CTelephonyAudioRouting::EHandset ) ); |
497 TRAPD( err2, iAudioRouting->SetOutputL( CTelephonyAudioRouting::EHandset ) ); |
498 if( err2 ) |
498 if( err2 ) |
499 { |
499 { |
500 TEFLOGSTRING2( KTAERROR, |
500 TEFLOGSTRING2( KTAERROR, |
501 "AUD CPEAudioData::SetTAROutput:Leave.2 (%d)", err ); |
501 "AUD CPEAudioData::SetTAROutput:Leave.2 (%d)", err ); |
502 } |
502 } |
503 break; |
503 break; |
504 default: |
504 default: |
505 // None |
505 // None |
506 break; |
506 break; |
507 } |
507 } |
508 } |
508 } |
509 #endif |
509 #endif |
510 } |
510 } |
511 |
511 |
512 // ----------------------------------------------------------------------------- |
512 // ----------------------------------------------------------------------------- |