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