25
|
1 |
/*
|
|
2 |
* Copyright (c) 2002-2005,2007 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description: Active object of the ringing tone player.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
// INCLUDE FILES
|
|
20 |
#include <e32base.h>
|
|
21 |
#include <f32file.h>
|
|
22 |
#include <utility.h>
|
|
23 |
#include <AudioPreference.h>
|
|
24 |
|
|
25 |
#include "phoneui.pan"
|
|
26 |
#include "cphoneringingtone.h"
|
|
27 |
#include "cphoneaudioplayer.h"
|
|
28 |
#include "cphonetimer.h"
|
|
29 |
#include "phoneringingtonesrvplayerao.h"
|
|
30 |
#include "phoneringingtonesrv.h"
|
|
31 |
#include "phoneconstants.h"
|
|
32 |
#include "phoneuiviewtrace.h"
|
|
33 |
|
|
34 |
#ifdef __WINS__
|
|
35 |
#include <data_caging_path_literals.hrh>
|
|
36 |
#endif
|
|
37 |
|
|
38 |
// ============================ MEMBER FUNCTIONS ===============================
|
|
39 |
|
|
40 |
// -----------------------------------------------------------------------------
|
|
41 |
// CPhoneRingingToneSrvPlayerAO::NewL
|
|
42 |
// -----------------------------------------------------------------------------
|
|
43 |
//
|
|
44 |
CPhoneRingingToneSrvPlayerAO* CPhoneRingingToneSrvPlayerAO::NewL( RFs& aFs )
|
|
45 |
{
|
|
46 |
CPhoneRingingToneSrvPlayerAO* self =
|
|
47 |
new ( ELeave ) CPhoneRingingToneSrvPlayerAO( aFs );
|
|
48 |
|
|
49 |
CleanupStack::PushL( self );
|
|
50 |
self->ConstructL();
|
|
51 |
CleanupStack::Pop( self );
|
|
52 |
|
|
53 |
return self;
|
|
54 |
}
|
|
55 |
|
|
56 |
// -----------------------------------------------------------------------------
|
|
57 |
// CPhoneRingingToneSrvPlayerAO::CPhoneRingingToneSrvPlayerAO
|
|
58 |
// -----------------------------------------------------------------------------
|
|
59 |
//
|
|
60 |
CPhoneRingingToneSrvPlayerAO::CPhoneRingingToneSrvPlayerAO( RFs &aFs ) :
|
|
61 |
CActive( CActive::EPriorityStandard ),
|
|
62 |
iFs( aFs ),
|
|
63 |
iAsyncDeletePlayers( EPlayerCount )
|
|
64 |
{
|
|
65 |
CActiveScheduler::Add( this );
|
|
66 |
}
|
|
67 |
|
|
68 |
// -----------------------------------------------------------------------------
|
|
69 |
// CPhoneRingingToneSrvPlayerAO::ConstructL
|
|
70 |
// -----------------------------------------------------------------------------
|
|
71 |
//
|
|
72 |
void CPhoneRingingToneSrvPlayerAO::ConstructL()
|
|
73 |
{
|
|
74 |
for ( TInt i = EPlayerFirst; i <= EPlayerLast; i++ )
|
|
75 |
{
|
|
76 |
User::LeaveIfError(
|
|
77 |
iAsyncDeletePlayers.Append( NULL ) );
|
|
78 |
}
|
|
79 |
|
|
80 |
// Construct timer.
|
|
81 |
iTimer = CPhoneTimer::NewL();
|
|
82 |
iTtsDelayTimer = CPhoneTimer::NewL();
|
|
83 |
|
|
84 |
ConstructPlayers();
|
|
85 |
}
|
|
86 |
|
|
87 |
// -----------------------------------------------------------------------------
|
|
88 |
// CPhoneRingingToneSrvPlayerAO::~CPhoneRingingToneSrvPlayerAO
|
|
89 |
// -----------------------------------------------------------------------------
|
|
90 |
//
|
|
91 |
CPhoneRingingToneSrvPlayerAO::~CPhoneRingingToneSrvPlayerAO()
|
|
92 |
{
|
|
93 |
Cancel();
|
|
94 |
|
|
95 |
iAsyncDeletePlayers.ResetAndDestroy();
|
|
96 |
iAsyncDeletePlayers.Close();
|
|
97 |
|
|
98 |
CleanupPlayers();
|
|
99 |
|
|
100 |
delete iTimer;
|
|
101 |
delete iTtsDelayTimer;
|
|
102 |
delete iDefaultRingingTone;
|
|
103 |
delete iAudioVideoRingingTone;
|
|
104 |
|
|
105 |
if ( iClientMessage.Handle() )
|
|
106 |
{
|
|
107 |
iClientMessage.Complete( KErrNone );
|
|
108 |
}
|
|
109 |
}
|
|
110 |
|
|
111 |
|
|
112 |
// -----------------------------------------------------------------------------
|
|
113 |
// CPhoneRingingToneSrvPlayerAO::PlayAudioRingTone
|
|
114 |
// -----------------------------------------------------------------------------
|
|
115 |
//
|
|
116 |
TBool CPhoneRingingToneSrvPlayerAO::PlayAudioRingTone(
|
|
117 |
TInt aVolume,
|
|
118 |
TProfileRingingType aRingingType,
|
|
119 |
const RMessage2& aMessage )
|
|
120 |
{
|
|
121 |
|
|
122 |
TBool messageSaved = EFalse;
|
|
123 |
iTimer->Cancel();
|
|
124 |
|
|
125 |
// Release any old client (shouldn't happen)
|
|
126 |
if ( iClientMessage.Handle() )
|
|
127 |
{
|
|
128 |
iClientMessage.Complete( KErrNone );
|
|
129 |
}
|
|
130 |
|
|
131 |
PHONEUIVIEW_PRINT( "CPhoneRingingToneSrvPlayerAO::PlayAudioRingTone <" );
|
|
132 |
PHONEUIVIEW_PRINTF2(
|
|
133 |
"CPhoneRingingToneSrvPlayerAO::PlayAudioRingTone - aVolume(%d), aRingingType(%d)",
|
|
134 |
aVolume,
|
|
135 |
aRingingType );
|
|
136 |
|
|
137 |
if ( !iAudioVideoRingingTone ||
|
|
138 |
!CheckAndHandleToneSizeLimit( iAudioVideoRingingTone ) )
|
|
139 |
{
|
|
140 |
PlayDefaultTone( aVolume, aRingingType );
|
|
141 |
}
|
|
142 |
else if ( aRingingType == EProfileRingingTypeSilent )
|
|
143 |
{
|
|
144 |
PlaySilentTone();
|
|
145 |
}
|
|
146 |
else if ( aRingingType == EProfileRingingTypeBeepOnce )
|
|
147 |
{
|
|
148 |
BeepOnce( aVolume );
|
|
149 |
}
|
|
150 |
else
|
|
151 |
{
|
|
152 |
// Construct player for line 1.
|
|
153 |
if ( !iAudioPlayer )
|
|
154 |
{
|
|
155 |
iAudioPlayer = ConstructTonePlayer(
|
|
156 |
*iAudioVideoRingingTone,
|
|
157 |
EPlayerAudio );
|
|
158 |
|
|
159 |
if ( !iTimer->IsActive() )
|
|
160 |
{
|
|
161 |
PHONEUIVIEW_PRINT( "RING TONE FAILSAFE TIMER START!!" );
|
|
162 |
// Start timer, since the player is constructed.
|
|
163 |
iTimer->After( KPhoneMaxRingingWaiting, this );
|
|
164 |
}
|
|
165 |
}
|
|
166 |
|
|
167 |
// Start playing.
|
|
168 |
if ( !iAudioPlayer )
|
|
169 |
{
|
|
170 |
iTimer->Cancel();
|
|
171 |
PlayDefaultTone( aVolume, aRingingType );
|
|
172 |
}
|
|
173 |
else
|
|
174 |
{
|
|
175 |
PHONEUIVIEW_PRINT(
|
|
176 |
"CPhoneRingingToneSrvPlayerAO::PlayAudioRingTone - Start playing audio" );
|
|
177 |
iVolume = aVolume;
|
|
178 |
iRingingType = aRingingType;
|
|
179 |
AddTtsPlaybackIfNeeded( aRingingType );
|
|
180 |
iTonePlayingStatus = EAudioTonePlaying;
|
|
181 |
|
|
182 |
// Save the client message which will be completed after init/error/timeout
|
|
183 |
iClientMessage = aMessage;
|
|
184 |
messageSaved = ETrue;
|
|
185 |
|
|
186 |
iAudioPlayer->Play(
|
|
187 |
ConvertRingingType( aRingingType ),
|
|
188 |
aVolume,
|
|
189 |
iTtsToneToBePlayed );
|
|
190 |
}
|
|
191 |
}
|
|
192 |
|
|
193 |
PHONEUIVIEW_PRINT( "CPhoneRingingToneSrvPlayerAO::PlayAudioRingTone >" );
|
|
194 |
|
|
195 |
return messageSaved;
|
|
196 |
}
|
|
197 |
|
|
198 |
// -----------------------------------------------------------------------------
|
|
199 |
// CPhoneRingingToneSrvPlayerAO::BeepOnce
|
|
200 |
// -----------------------------------------------------------------------------
|
|
201 |
//
|
|
202 |
void CPhoneRingingToneSrvPlayerAO::BeepOnce( TInt aVolume )
|
|
203 |
{
|
|
204 |
PHONEUIVIEW_PRINT( "CPhoneRingingToneSrvPlayerAO::BeepOnce <" );
|
|
205 |
PHONEUIVIEW_PRINTF( "CPhoneRingingToneSrvPlayerAO::BeepOnce - aVolume(%d)", aVolume );
|
|
206 |
|
|
207 |
if ( !iBeepOncePlayer )
|
|
208 |
{
|
|
209 |
ConstructSequencePlayer( EPlayerBeepOnce );
|
|
210 |
}
|
|
211 |
|
|
212 |
if ( iBeepOncePlayer )
|
|
213 |
{
|
|
214 |
PHONEUIVIEW_PRINT( "CPhoneRingingToneSrvPlayerAO::BeepOnce - Play" );
|
|
215 |
iTonePlayingStatus = EBeepOnce;
|
|
216 |
iBeepOncePlayer->Play( CPhoneAudioPlayer::ETypeRingingOnce,
|
|
217 |
aVolume, EFalse );
|
|
218 |
}
|
|
219 |
PHONEUIVIEW_PRINT( "CPhoneRingingToneSrvPlayerAO::BeepOnce >" );
|
|
220 |
}
|
|
221 |
|
|
222 |
// -----------------------------------------------------------------------------
|
|
223 |
// CPhoneRingingToneSrvPlayerAO,::PlaySilentTone
|
|
224 |
// -----------------------------------------------------------------------------
|
|
225 |
//
|
|
226 |
void CPhoneRingingToneSrvPlayerAO::PlaySilentTone()
|
|
227 |
{
|
|
228 |
PHONEUIVIEW_PRINT( "CPhoneRingingToneSrvPlayerAO::PlaySilentTone <" );
|
|
229 |
|
|
230 |
if ( !iSilentPlayer )
|
|
231 |
{
|
|
232 |
ConstructSequencePlayer( EPlayerSilent );
|
|
233 |
}
|
|
234 |
|
|
235 |
__ASSERT_DEBUG( iSilentPlayer, Panic( EPhoneViewGeneralError ) );
|
|
236 |
|
|
237 |
if ( iSilentPlayer )
|
|
238 |
{
|
|
239 |
PHONEUIVIEW_PRINT( "CPhoneRingingToneSrvPlayerAO::PlaySilentTone - play" );
|
|
240 |
iTonePlayingStatus = ESilentTonePlaying;
|
|
241 |
iSilentPlayer->Play( CPhoneAudioPlayer::ETypeRinging, 0, EFalse );
|
|
242 |
}
|
|
243 |
|
|
244 |
PHONEUIVIEW_PRINT( "CPhoneRingingToneSrvPlayerAO::PlaySilentTone >" );
|
|
245 |
}
|
|
246 |
|
|
247 |
// -----------------------------------------------------------------------------
|
|
248 |
// CPhoneRingingToneSrvPlayerAO::PlayUnsecureVoIPTone
|
|
249 |
// -----------------------------------------------------------------------------
|
|
250 |
//
|
|
251 |
void CPhoneRingingToneSrvPlayerAO::PlayUnsecureVoIPTone()
|
|
252 |
{
|
|
253 |
PHONEUIVIEW_PRINT( "CPhoneRingingToneSrvPlayerAO::PlayUnsecureVoIPTone <" );
|
|
254 |
if ( !iUnsecureVoIPTonePlayer )
|
|
255 |
{
|
|
256 |
ConstructSequencePlayer( EPlayerUnsecureVoIP );
|
|
257 |
}
|
|
258 |
__ASSERT_DEBUG( iUnsecureVoIPTonePlayer, Panic( EPhoneViewGeneralError ) );
|
|
259 |
|
|
260 |
if ( iUnsecureVoIPTonePlayer )
|
|
261 |
{
|
|
262 |
iTonePlayingStatus = EUnsecureVoIPTonePlaying;
|
|
263 |
iUnsecureVoIPTonePlayer->Play( CPhoneAudioPlayer::ETypeRingingOnce,
|
|
264 |
KPhoneDefaultVolume, EFalse );
|
|
265 |
}
|
|
266 |
|
|
267 |
PHONEUIVIEW_PRINT( "CPhoneRingingToneSrvPlayerAO::PlayUnsecureVoIPTone >" );
|
|
268 |
}
|
|
269 |
|
|
270 |
// -----------------------------------------------------------------------------
|
|
271 |
// CPhoneRingingToneSrvPlayerAO::MuteRingingTone
|
|
272 |
// -----------------------------------------------------------------------------
|
|
273 |
//
|
|
274 |
void CPhoneRingingToneSrvPlayerAO::MuteRingingTone()
|
|
275 |
{
|
|
276 |
PHONEUIVIEW_PRINT( "CPhoneRingingToneSrvPlayerAO::MuteRingingTone <" );
|
|
277 |
|
|
278 |
CPhoneAudioPlayer* activePlayer = ActiveAudioPlayer();
|
|
279 |
if ( activePlayer )
|
|
280 |
{
|
|
281 |
activePlayer->MutePlaying();
|
|
282 |
}
|
|
283 |
|
|
284 |
PHONEUIVIEW_PRINT( "CPhoneRingingToneSrvPlayerAO::MuteRingingTone >" );
|
|
285 |
}
|
|
286 |
|
|
287 |
// -----------------------------------------------------------------------------
|
|
288 |
// CPhoneRingingToneSrvPlayerAO::StopPlaying
|
|
289 |
// -----------------------------------------------------------------------------
|
|
290 |
//
|
|
291 |
void CPhoneRingingToneSrvPlayerAO::StopPlaying()
|
|
292 |
{
|
|
293 |
PHONEUIVIEW_PRINT( "CPhoneRingingToneSrvPlayerAO::StopPlaying <" );
|
|
294 |
|
|
295 |
// Complete waiting client just in case
|
|
296 |
if ( iClientMessage.Handle() )
|
|
297 |
{
|
|
298 |
iClientMessage.Complete( KErrNone );
|
|
299 |
}
|
|
300 |
|
|
301 |
iTtsToneToBePlayed = EFalse;
|
|
302 |
iTTsTimeOutCounter = 0;
|
|
303 |
iTtsDelayTimer->Cancel();
|
|
304 |
if ( iTtsPlayer )
|
|
305 |
{
|
|
306 |
iTtsPlayer->StopPlaying();
|
|
307 |
delete iTtsPlayer;
|
|
308 |
iTtsPlayer = NULL;
|
|
309 |
}
|
|
310 |
iTimer->Cancel();
|
|
311 |
|
|
312 |
switch( iTonePlayingStatus )
|
|
313 |
{
|
|
314 |
case EAudioTonePlaying:
|
|
315 |
if ( iAudioPlayer )
|
|
316 |
{
|
|
317 |
// Commented stopping out, since with this, the screen is jammed
|
|
318 |
// when REComSession::FinalClose() is reached in
|
|
319 |
// CPhoneAudioPlayer's destructor.
|
|
320 |
// Audio player is stopped anyway in its destructor.
|
|
321 |
// Fixes EKKI-7WYG2G and JKAN-7XNGQU.
|
|
322 |
// iAudioPlayer->StopPlaying();
|
|
323 |
delete iAudioPlayer;
|
|
324 |
iAudioPlayer = NULL;
|
|
325 |
}
|
|
326 |
break;
|
|
327 |
case EDefaultTonePlaying:
|
|
328 |
if ( iDefaultPlayer )
|
|
329 |
{
|
|
330 |
iDefaultPlayer->StopPlaying();
|
|
331 |
delete iDefaultPlayer;
|
|
332 |
iDefaultPlayer = NULL;
|
|
333 |
}
|
|
334 |
break;
|
|
335 |
case EBeepOnce:
|
|
336 |
if ( iBeepOncePlayer )
|
|
337 |
{
|
|
338 |
iBeepOncePlayer->StopPlaying();
|
|
339 |
delete iBeepOncePlayer;
|
|
340 |
iBeepOncePlayer = NULL;
|
|
341 |
}
|
|
342 |
break;
|
|
343 |
case EBackupTonePlaying:
|
|
344 |
if ( iBackupPlayer )
|
|
345 |
{
|
|
346 |
iBackupPlayer->StopPlaying();
|
|
347 |
}
|
|
348 |
break;
|
|
349 |
case ESilentTonePlaying:
|
|
350 |
if ( iSilentPlayer )
|
|
351 |
{
|
|
352 |
iSilentPlayer->StopPlaying();
|
|
353 |
delete iSilentPlayer;
|
|
354 |
iSilentPlayer = NULL;
|
|
355 |
}
|
|
356 |
break;
|
|
357 |
case EUnsecureVoIPTonePlaying:
|
|
358 |
if ( iUnsecureVoIPTonePlayer )
|
|
359 |
{
|
|
360 |
iUnsecureVoIPTonePlayer->StopPlaying();
|
|
361 |
delete iUnsecureVoIPTonePlayer;
|
|
362 |
iUnsecureVoIPTonePlayer = NULL;
|
|
363 |
}
|
|
364 |
break;
|
|
365 |
case EIdle:
|
|
366 |
break;
|
|
367 |
default:
|
|
368 |
Panic( EPhoneViewCaseNotHandled );
|
|
369 |
break;
|
|
370 |
}
|
|
371 |
|
|
372 |
iTonePlayingStatus = EIdle;
|
|
373 |
|
|
374 |
PHONEUIVIEW_PRINT( "CPhoneRingingToneSrvPlayerAO::StopPlaying >" );
|
|
375 |
}
|
|
376 |
|
|
377 |
// -----------------------------------------------------------------------------
|
|
378 |
// CPhoneRingingToneSrvPlayerAO::PlayTtsTone
|
|
379 |
// -----------------------------------------------------------------------------
|
|
380 |
//
|
|
381 |
void CPhoneRingingToneSrvPlayerAO::PlayTtsTone(
|
|
382 |
const TDesC& aTextToSay,
|
|
383 |
TInt aVolume,
|
|
384 |
TProfileRingingType aRingingType )
|
|
385 |
{
|
|
386 |
PHONEUIVIEW_PRINT( "CPhoneRingingToneSrvPlayerAO::PlayTtsTone <" );
|
|
387 |
PHONEUIVIEW_PRINTF2(
|
|
388 |
"CPhoneRingingToneSrvPlayerAO::PlayTtsTone - aVolume(%d), aRingingType(%d)",
|
|
389 |
aVolume, aRingingType );
|
|
390 |
|
|
391 |
if ( iTtsPlayer )
|
|
392 |
{
|
|
393 |
delete iTtsPlayer;
|
|
394 |
iTtsPlayer = NULL;
|
|
395 |
}
|
|
396 |
|
|
397 |
//Set ringingtype for Tts.
|
|
398 |
iTtsRingingType = aRingingType;
|
|
399 |
iTtsVolume = aVolume;
|
|
400 |
|
|
401 |
// TTS should be a bit louder, than main component.
|
|
402 |
// No need to check for overflows, they are handled in SET_PHONE_VOLUME macro.
|
|
403 |
|
|
404 |
TPtrC ttsHeader( KPhoneTtsHeader );
|
|
405 |
HBufC* preparedString =
|
|
406 |
HBufC::New( aTextToSay.Length() + ttsHeader.Length() );
|
|
407 |
|
|
408 |
if ( !preparedString )
|
|
409 |
{
|
|
410 |
PHONEUIVIEW_PRINTF3(
|
|
411 |
"CPhoneRingingToneSrvPlayerAO::PlayTtsTone: Couldn't allocate buf %d + %d = %d",
|
|
412 |
aTextToSay.Length(), ttsHeader.Length(), aTextToSay.Length()+ttsHeader.Length() );
|
|
413 |
}
|
|
414 |
else
|
|
415 |
{
|
|
416 |
TPtr pPreparedString = preparedString->Des();
|
|
417 |
pPreparedString.Append( ttsHeader );
|
|
418 |
pPreparedString.Append( aTextToSay );
|
|
419 |
|
|
420 |
PHONEUIVIEW_PRINTF( "CPhoneRingingToneSrvPlayerAO::PlayTtsTone - about to say %S",
|
|
421 |
&pPreparedString );
|
|
422 |
|
|
423 |
TRAPD(
|
|
424 |
error,
|
|
425 |
iTtsPlayer = CPhoneAudioPlayer::NewTtsL(
|
|
426 |
*preparedString,
|
|
427 |
KAudioPriorityPhoneCall,
|
|
428 |
KAudioPrefTextToSpeechCallHardCoded,
|
|
429 |
*this,
|
|
430 |
EPlayerTts ) );
|
|
431 |
if ( error == KErrNone )
|
|
432 |
{
|
|
433 |
// To be played when default or personal tone will be played
|
|
434 |
iTtsToneToBePlayed = ETrue;
|
|
435 |
}
|
|
436 |
PHONEUIVIEW_PRINTF2(
|
|
437 |
"CPhoneRingingToneSrvPlayerAO::PlayTtsTone - error(%d), iTtsPhoneToBePlayed(%d)",
|
|
438 |
error,
|
|
439 |
iTtsToneToBePlayed );
|
|
440 |
|
|
441 |
delete preparedString;
|
|
442 |
}
|
|
443 |
|
|
444 |
PHONEUIVIEW_PRINT( "CPhoneRingingToneSrvPlayerAO::PlayTtsTone >" );
|
|
445 |
}
|
|
446 |
|
|
447 |
// -----------------------------------------------------------------------------
|
|
448 |
// CPhoneRingingToneSrvPlayerAO::HandleAudioPlayerError
|
|
449 |
// -----------------------------------------------------------------------------
|
|
450 |
//
|
|
451 |
void CPhoneRingingToneSrvPlayerAO::HandleAudioPlayerError(
|
|
452 |
TPhoneAudioPlayerErrorEvent /*aEvent*/,
|
|
453 |
TInt aError,
|
|
454 |
TInt /*aId*/ )
|
|
455 |
{
|
|
456 |
PHONEUIVIEW_PRINT( "CPhoneRingingToneSrvPlayerAO::HandleAudioPlayerError <" );
|
|
457 |
// This is called from CPhoneAudioPlayer - we do not
|
|
458 |
// want to delete instances from which this method
|
|
459 |
// is called.
|
|
460 |
|
|
461 |
PHONEUIVIEW_PRINTF( "CPhoneRingingToneSrvPlayerAO::HandleAudioPlayerError: error = %d", aError );
|
|
462 |
|
|
463 |
const TBool deleteAll = ( aError == KErrServerTerminated );
|
|
464 |
|
|
465 |
if ( deleteAll )
|
|
466 |
{
|
|
467 |
// KErrServerTerminated is considered as fatal error. So we
|
|
468 |
// need to delete everything.
|
|
469 |
|
|
470 |
for ( TInt i = EPlayerFirst; i <= EPlayerLast; i++ )
|
|
471 |
{
|
|
472 |
DeletePlayerAsync( static_cast< TPlayerId >( i ) );
|
|
473 |
}
|
|
474 |
|
|
475 |
// Now all member audio players point to NULL, except
|
|
476 |
// those players in iAsyncDeletePlayers. Recreate
|
|
477 |
// players.
|
|
478 |
|
|
479 |
ConstructPlayers(); // Ignore error code.
|
|
480 |
}
|
|
481 |
|
|
482 |
iTimer->Cancel();
|
|
483 |
DoHandlePlayerError( !deleteAll, EFalse );
|
|
484 |
}
|
|
485 |
|
|
486 |
// -----------------------------------------------------------------------------
|
|
487 |
// CPhoneRingingToneSrvPlayerAO::HandleAudioPlayerInitComplete
|
|
488 |
// -----------------------------------------------------------------------------
|
|
489 |
//
|
|
490 |
void CPhoneRingingToneSrvPlayerAO::HandleAudioPlayerInitComplete( TInt aId )
|
|
491 |
{
|
|
492 |
PHONEUIVIEW_PRINT( "CPhoneRingingToneSrvPlayerAO::HandleAudioPlayerInitComplete <" );
|
|
493 |
|
|
494 |
// This is called from CPhoneAudioPlayer - we do not
|
|
495 |
// want to delete instances from which this method
|
|
496 |
// is called.
|
|
497 |
|
|
498 |
// Complete waiting client
|
|
499 |
if ( iClientMessage.Handle() )
|
|
500 |
{
|
|
501 |
iClientMessage.Complete( KErrNone );
|
|
502 |
}
|
|
503 |
|
|
504 |
if ( iTonePlayingStatus == EAudioTonePlaying && aId == EPlayerAudio ||
|
|
505 |
iTonePlayingStatus == EDefaultTonePlaying && aId == EPlayerDefault )
|
|
506 |
{
|
|
507 |
PHONEUIVIEW_PRINT( "RING TONE FAILSAFE TIMER STOP!!" );
|
|
508 |
iTimer->Cancel();
|
|
509 |
}
|
|
510 |
|
|
511 |
if ( iTtsToneToBePlayed && ( aId != EPlayerTts ) )
|
|
512 |
{
|
|
513 |
// Start TTS timer just before "normal ringtone component" starts
|
|
514 |
// playing, i.e. after init completed.
|
|
515 |
if ( iTtsDelayIndex < iTtsDelaysCount )
|
|
516 |
{
|
|
517 |
if ( !iTtsDelayTimer->IsActive() )
|
|
518 |
{
|
|
519 |
// There are TTS iterations to be played yet.
|
|
520 |
iTtsDelayTimer->After(
|
|
521 |
KPhoneTtsDelays[iTtsDelayIndex],
|
|
522 |
TCallBack( HandleTtsDelayTimeout, this ) );
|
|
523 |
}
|
|
524 |
}
|
|
525 |
}
|
|
526 |
|
|
527 |
PHONEUIVIEW_PRINT( "CPhoneRingingToneSrvPlayerAO::HandleAudioPlayerInitComplete >" );
|
|
528 |
}
|
|
529 |
|
|
530 |
// -----------------------------------------------------------------------------
|
|
531 |
// CPhoneRingingToneSrvPlayerAO::HandlePlayingComplete
|
|
532 |
// -----------------------------------------------------------------------------
|
|
533 |
//
|
|
534 |
void CPhoneRingingToneSrvPlayerAO::HandlePlayingComplete( TInt aId )
|
|
535 |
{
|
|
536 |
PHONEUIVIEW_PRINT( "CPhoneRingingToneSrvPlayerAO::HandlePlayingComplete <" );
|
|
537 |
// This is called from CPhoneAudioPlayer - we do not
|
|
538 |
// want to delete instances from which this method
|
|
539 |
// is called.
|
|
540 |
|
|
541 |
// Complete waiting client (shouldn't reach this far, but who knows)
|
|
542 |
if ( iClientMessage.Handle() )
|
|
543 |
{
|
|
544 |
iClientMessage.Complete( KErrNone );
|
|
545 |
}
|
|
546 |
|
|
547 |
PHONEUIVIEW_PRINTF2(
|
|
548 |
"CPhoneRingingToneSrvPlayerAO::HandlePlayingComplete - aId(%d), iRingingType(%d)",
|
|
549 |
aId,
|
|
550 |
iRingingType );
|
|
551 |
|
|
552 |
PHONEUIVIEW_PRINTF2(
|
|
553 |
"CPhoneRingingToneSrvPlayerAO::HandlePlayingComplete - iTtsToneToBePlayed(%d), iTtsDelayIndex(%d)",
|
|
554 |
iTtsToneToBePlayed,
|
|
555 |
iTtsDelayIndex );
|
|
556 |
|
|
557 |
if ( aId == EPlayerTts )
|
|
558 |
{
|
|
559 |
PHONEUIVIEW_PRINT( "CPhoneRingingToneSrvPlayerAO::HandlePlayingComplete - resuming after TTS" );
|
|
560 |
|
|
561 |
// TTS playing complete, normal tone player should volume up.
|
|
562 |
if ( ( iTtsToneToBePlayed ) && ( ++iTtsDelayIndex < iTtsDelaysCount ) )
|
|
563 |
{
|
|
564 |
PHONEUIVIEW_PRINT( "CPhoneRingingToneSrvPlayerAO::HandlePlayingComplete - resuming after TTS first time" );
|
|
565 |
|
|
566 |
//Callers name is said once. increase tone player volume.
|
|
567 |
SolveNewVolumeAndRamptime( ESaidOnce );
|
|
568 |
|
|
569 |
if ( !iTtsDelayTimer->IsActive() )
|
|
570 |
{
|
|
571 |
// There are TTS iterations to be played yet.
|
|
572 |
iTtsDelayTimer->After( KPhoneTtsDelays[iTtsDelayIndex],
|
|
573 |
TCallBack( HandleTtsDelayTimeout,this ) );
|
|
574 |
}
|
|
575 |
}
|
|
576 |
else
|
|
577 |
{
|
|
578 |
PHONEUIVIEW_PRINT( "CPhoneRingingToneSrvPlayerAO::HandlePlayingComplete - resuming after TTS second time" );
|
|
579 |
SolveNewVolumeAndRamptime( ESaidTwice );
|
|
580 |
}
|
|
581 |
|
|
582 |
// No further processing. All TTS player-related events are not
|
|
583 |
// "real" ringtone playing completions.
|
|
584 |
return;
|
|
585 |
}
|
|
586 |
|
|
587 |
//Case: RingintonePlayer has completed playing with following set: ring once and
|
|
588 |
// TTS is activated
|
|
589 |
else if ( iRingingType == EProfileRingingTypeRingingOnce &&
|
|
590 |
iTtsToneToBePlayed )
|
|
591 |
{
|
|
592 |
PHONEUIVIEW_PRINT( "CPhoneRingingToneSrvPlayerAO::HandlePlayingComplete - ring once and TTS" );
|
|
593 |
if ( iTtsDelayIndex < iTtsDelaysCount )
|
|
594 |
{
|
|
595 |
ReStartRingingTonePlayer();
|
|
596 |
//Do not destroy player yet. Return.
|
|
597 |
return;
|
|
598 |
}
|
|
599 |
}
|
|
600 |
//Case: RingintonePlayer has completed playing with following set: ringing
|
|
601 |
//and TTS is activated. We need to restart ringintoneplayer and new TTS
|
|
602 |
//iterations are required.
|
|
603 |
else if ( iRingingType == EProfileRingingTypeRinging && iTtsToneToBePlayed )
|
|
604 |
{
|
|
605 |
PHONEUIVIEW_PRINT( "CPhoneRingingToneSrvPlayerAO::HandlePlayingComplete - ringing and TTS" );
|
|
606 |
if ( iTtsDelayIndex == iTtsDelaysCount )
|
|
607 |
{
|
|
608 |
//Case: Ringingtype is EProfileRingingTypeRinging. New TTS
|
|
609 |
//iterations are required.
|
|
610 |
PHONEUIVIEW_PRINT( "CPhoneRingingToneSrvPlayerAO::HandlePlayingComplete - need to restart TTS sequence" );
|
|
611 |
//TTS has completed its iterations,set index to zero.
|
|
612 |
iTtsDelayIndex = 0;
|
|
613 |
if ( !iTtsDelayTimer->IsActive() )
|
|
614 |
{
|
|
615 |
//Restart TTS sequence
|
|
616 |
iTtsDelayTimer->After(
|
|
617 |
KPhoneTtsDelays[iTtsDelayIndex],
|
|
618 |
TCallBack( HandleTtsDelayTimeout, this ) );
|
|
619 |
}
|
|
620 |
}
|
|
621 |
|
|
622 |
ReStartRingingTonePlayer();
|
|
623 |
//Do not destroy player yet. Return
|
|
624 |
return;
|
|
625 |
}
|
|
626 |
|
|
627 |
PHONEUIVIEW_PRINTF(
|
|
628 |
"CPhoneRingingToneSrvPlayerAO::HandlePlayingComplete - delete player - iTonePlayingStatus(%d)",
|
|
629 |
iTonePlayingStatus );
|
|
630 |
switch( iTonePlayingStatus )
|
|
631 |
{
|
|
632 |
case EAudioTonePlaying:
|
|
633 |
DeletePlayerAsync( EPlayerAudio );
|
|
634 |
iAudioPlayer = NULL;
|
|
635 |
break;
|
|
636 |
|
|
637 |
case EDefaultTonePlaying:
|
|
638 |
DeletePlayerAsync( EPlayerDefault );
|
|
639 |
iDefaultPlayer = NULL;
|
|
640 |
break;
|
|
641 |
|
|
642 |
case ESilentTonePlaying:
|
|
643 |
DeletePlayerAsync( EPlayerSilent );
|
|
644 |
iSilentPlayer = NULL;
|
|
645 |
break;
|
|
646 |
|
|
647 |
case EUnsecureVoIPTonePlaying:
|
|
648 |
DeletePlayerAsync( EPlayerUnsecureVoIP );
|
|
649 |
iUnsecureVoIPTonePlayer = NULL;
|
|
650 |
break;
|
|
651 |
case EBeepOnce:
|
|
652 |
DeletePlayerAsync( EPlayerBeepOnce );
|
|
653 |
iBeepOncePlayer = NULL;
|
|
654 |
break;
|
|
655 |
|
|
656 |
case EBackupTonePlaying:
|
|
657 |
break;
|
|
658 |
|
|
659 |
default:
|
|
660 |
Panic( EPhoneViewCaseNotHandled );
|
|
661 |
break;
|
|
662 |
}
|
|
663 |
|
|
664 |
iTonePlayingStatus = EIdle;
|
|
665 |
}
|
|
666 |
|
|
667 |
|
|
668 |
// -----------------------------------------------------------------------------
|
|
669 |
// CPhoneRingingToneSrvPlayerAO::HandleTimeOutL
|
|
670 |
// -----------------------------------------------------------------------------
|
|
671 |
//
|
|
672 |
void CPhoneRingingToneSrvPlayerAO::HandleTimeOutL()
|
|
673 |
{
|
|
674 |
PHONEUIVIEW_PRINT( "CPhoneRingingToneSrvPlayerAO::HandleTimeOutL <" );
|
|
675 |
|
|
676 |
|
|
677 |
// Guarding timer for startup has expired
|
|
678 |
|
|
679 |
|
|
680 |
PHONEUIVIEW_PRINT( "RING TONE FAILSAFE TIMER TRIGGERED!!" );
|
|
681 |
|
|
682 |
// Start new audio player synchronously.
|
|
683 |
DoHandlePlayerError( ETrue, ETrue );
|
|
684 |
|
|
685 |
PHONEUIVIEW_PRINT( "CPhoneRingingToneSrvPlayerAO::HandleTimeOutL >" );
|
|
686 |
}
|
|
687 |
|
|
688 |
// -----------------------------------------------------------------------------
|
|
689 |
// CPhoneRingingToneSrvPlayerAO::DoHandlePlayerError
|
|
690 |
// -----------------------------------------------------------------------------
|
|
691 |
//
|
|
692 |
void CPhoneRingingToneSrvPlayerAO::DoHandlePlayerError(
|
|
693 |
TBool aDelete,
|
|
694 |
TBool aSync )
|
|
695 |
{
|
|
696 |
PHONEUIVIEW_PRINT( "CPhoneRingingToneSrvPlayerAO::DoHandlePlayerError <" );
|
|
697 |
|
|
698 |
PHONEUIVIEW_PRINTF(
|
|
699 |
"CPhoneRingingToneSrvPlayerAO::DoHandlePlayerError: iTonePlayingStatus = %d",
|
|
700 |
iTonePlayingStatus );
|
|
701 |
|
|
702 |
// Complete waiting client
|
|
703 |
if ( iClientMessage.Handle() )
|
|
704 |
{
|
|
705 |
iClientMessage.Complete( KErrNone );
|
|
706 |
}
|
|
707 |
|
|
708 |
switch ( iTonePlayingStatus )
|
|
709 |
{
|
|
710 |
case EAudioTonePlaying:
|
|
711 |
if ( aDelete )
|
|
712 |
{
|
|
713 |
if ( aSync )
|
|
714 |
{
|
|
715 |
delete iAudioPlayer;
|
|
716 |
}
|
|
717 |
else
|
|
718 |
{
|
|
719 |
DeletePlayerAsync( EPlayerAudio );
|
|
720 |
}
|
|
721 |
|
|
722 |
iAudioPlayer = NULL;
|
|
723 |
}
|
|
724 |
|
|
725 |
#ifdef __WINS__
|
|
726 |
PlayAudioRingTone( iVolume, iRingingType, iClientMessage );
|
|
727 |
iTonePlayingStatus = EDefaultTonePlaying;
|
|
728 |
#else
|
|
729 |
PlayDefaultTone( iVolume, iRingingType );
|
|
730 |
#endif
|
|
731 |
break;
|
|
732 |
case EDefaultTonePlaying:
|
|
733 |
if ( aDelete )
|
|
734 |
{
|
|
735 |
if ( aSync )
|
|
736 |
{
|
|
737 |
delete iDefaultPlayer;
|
|
738 |
}
|
|
739 |
else
|
|
740 |
{
|
|
741 |
DeletePlayerAsync( EPlayerDefault );
|
|
742 |
}
|
|
743 |
|
|
744 |
iDefaultPlayer = NULL;
|
|
745 |
}
|
|
746 |
|
|
747 |
PlayBackupTone( iVolume, iRingingType );
|
|
748 |
break;
|
|
749 |
case ESilentTonePlaying:
|
|
750 |
case EBeepOnce:
|
|
751 |
case EBackupTonePlaying:
|
|
752 |
break;
|
|
753 |
default:
|
|
754 |
break;
|
|
755 |
}
|
|
756 |
PHONEUIVIEW_PRINT( "CPhoneRingingToneSrvPlayerAO::DoHandlePlayerError >" );
|
|
757 |
}
|
|
758 |
|
|
759 |
// -----------------------------------------------------------------------------
|
|
760 |
// CPhoneRingingToneSrvPlayerAO::PlayDefaultTone
|
|
761 |
// -----------------------------------------------------------------------------
|
|
762 |
//
|
|
763 |
void CPhoneRingingToneSrvPlayerAO::PlayDefaultTone(
|
|
764 |
TInt aVolume,
|
|
765 |
TProfileRingingType aRingingType )
|
|
766 |
{
|
|
767 |
PHONEUIVIEW_PRINT( "CPhoneRingingToneSrvPlayerAO::PlayDefaultTone()" );
|
|
768 |
|
|
769 |
if( aRingingType == EProfileRingingTypeSilent ||
|
|
770 |
aRingingType == EProfileRingingTypeBeepOnce )
|
|
771 |
{
|
|
772 |
return;
|
|
773 |
}
|
|
774 |
|
|
775 |
if ( !iDefaultRingingTone )
|
|
776 |
{
|
|
777 |
PHONEUIVIEW_PRINT( "CPhoneRingingToneSrvPlayerAO::PlayDefaultTone - default tone does not exist, play backup..." );
|
|
778 |
PlayBackupTone( aVolume, aRingingType );
|
|
779 |
return;
|
|
780 |
}
|
|
781 |
|
|
782 |
// Construct player.
|
|
783 |
if ( !iDefaultPlayer )
|
|
784 |
{
|
|
785 |
iDefaultPlayer = ConstructTonePlayer(
|
|
786 |
*iDefaultRingingTone,
|
|
787 |
EPlayerDefault );
|
|
788 |
if ( !iTimer->IsActive() )
|
|
789 |
{
|
|
790 |
PHONEUIVIEW_PRINT( "RING TONE FAILSAFE TIMER START!!" );
|
|
791 |
iTimer->After( KPhoneMaxRingingWaiting, this );
|
|
792 |
}
|
|
793 |
}
|
|
794 |
|
|
795 |
// Start playing.
|
|
796 |
if ( !iDefaultPlayer )
|
|
797 |
{
|
|
798 |
PHONEUIVIEW_PRINT( "CPhoneRingingToneSrvPlayerAO::PlayDefaultTone - player not constructed, play backup..." );
|
|
799 |
iTimer->Cancel();
|
|
800 |
PlayBackupTone( aVolume, aRingingType );
|
|
801 |
}
|
|
802 |
else
|
|
803 |
{
|
|
804 |
PHONEUIVIEW_PRINT( "CPhoneRingingToneSrvPlayerAO::PlayDefaultTone - play" );
|
|
805 |
iVolume = aVolume;
|
|
806 |
iRingingType = aRingingType;
|
|
807 |
iTonePlayingStatus = EDefaultTonePlaying;
|
|
808 |
iDefaultPlayer->Play(
|
|
809 |
ConvertRingingType( aRingingType ), aVolume, iTtsToneToBePlayed );
|
|
810 |
}
|
|
811 |
|
|
812 |
}
|
|
813 |
|
|
814 |
// -----------------------------------------------------------------------------
|
|
815 |
// CPhoneRingingToneSrvPlayerAO::PlayBackupTone
|
|
816 |
// -----------------------------------------------------------------------------
|
|
817 |
//
|
|
818 |
void CPhoneRingingToneSrvPlayerAO::PlayBackupTone(
|
|
819 |
TInt aVolume,
|
|
820 |
TProfileRingingType aRingingType )
|
|
821 |
{
|
|
822 |
PHONEUIVIEW_PRINT( "CPhoneRingingToneSrvPlayerAO::PlayBackupTone()" );
|
|
823 |
__ASSERT_DEBUG( iBackupPlayer, Panic( EPhoneViewGeneralError ) );
|
|
824 |
|
|
825 |
if ( !iBackupPlayer )
|
|
826 |
{
|
|
827 |
ConstructPlayers();
|
|
828 |
}
|
|
829 |
|
|
830 |
if ( iBackupPlayer )
|
|
831 |
{
|
|
832 |
PHONEUIVIEW_PRINT( "CPhoneRingingToneSrvPlayerAO::PlayBackupTone - play" );
|
|
833 |
iTonePlayingStatus = EBackupTonePlaying;
|
|
834 |
|
|
835 |
// Cease playing text-to-speech, if necessary
|
|
836 |
iTtsToneToBePlayed = EFalse;
|
|
837 |
iTTsTimeOutCounter = 0;
|
|
838 |
iTtsDelayTimer->Cancel();
|
|
839 |
if ( iTtsPlayer )
|
|
840 |
{
|
|
841 |
iTtsPlayer->StopPlaying();
|
|
842 |
delete iTtsPlayer;
|
|
843 |
iTtsPlayer = NULL;
|
|
844 |
}
|
|
845 |
|
|
846 |
iBackupPlayer->Play(
|
|
847 |
ConvertRingingType( aRingingType ), aVolume, EFalse );
|
|
848 |
}
|
|
849 |
}
|
|
850 |
|
|
851 |
// -----------------------------------------------------------------------------
|
|
852 |
// CPhoneRingingToneSrvPlayerAO::ConstructTonePlayer
|
|
853 |
// -----------------------------------------------------------------------------
|
|
854 |
//
|
|
855 |
CPhoneAudioPlayer* CPhoneRingingToneSrvPlayerAO::ConstructTonePlayer(
|
|
856 |
const CPhoneRingingTone& aRingingTone,
|
|
857 |
TInt aId )
|
|
858 |
{
|
|
859 |
PHONEUIVIEW_PRINT( "CPhoneRingingToneSrvPlayerAO::ConstructTonePlayer" );
|
|
860 |
return CPhoneAudioPlayer::New(
|
|
861 |
aRingingTone,
|
|
862 |
KAudioPriorityPhoneCall,
|
|
863 |
KAudioPrefIncomingCall,
|
|
864 |
*this,
|
|
865 |
aId,
|
|
866 |
iMdaServer,
|
|
867 |
aId == EPlayerDefault ? EFalse : iExtSecNeeded );
|
|
868 |
}
|
|
869 |
|
|
870 |
// -----------------------------------------------------------------------------
|
|
871 |
// CPhoneRingingToneSrvPlayerAO::ConvertRingingType
|
|
872 |
// -----------------------------------------------------------------------------
|
|
873 |
//
|
|
874 |
CPhoneAudioPlayer::TRingingType CPhoneRingingToneSrvPlayerAO::ConvertRingingType(
|
|
875 |
TProfileRingingType aRingingType )
|
|
876 |
{
|
|
877 |
CPhoneAudioPlayer::TRingingType ringingType =
|
|
878 |
CPhoneAudioPlayer::ETypeRinging;
|
|
879 |
switch ( aRingingType )
|
|
880 |
{
|
|
881 |
case EProfileRingingTypeRinging:
|
|
882 |
ringingType = CPhoneAudioPlayer::ETypeRinging;
|
|
883 |
break;
|
|
884 |
|
|
885 |
case EProfileRingingTypeAscending:
|
|
886 |
ringingType = CPhoneAudioPlayer::ETypeAscending;
|
|
887 |
break;
|
|
888 |
|
|
889 |
case EProfileRingingTypeRingingOnce:
|
|
890 |
ringingType = CPhoneAudioPlayer::ETypeRingingOnce;
|
|
891 |
break;
|
|
892 |
|
|
893 |
default:
|
|
894 |
break;
|
|
895 |
}
|
|
896 |
return ringingType;
|
|
897 |
}
|
|
898 |
|
|
899 |
// -----------------------------------------------------------------------------
|
|
900 |
// CPhoneRingingToneSrvPlayerAO::ConstructPlayers
|
|
901 |
// -----------------------------------------------------------------------------
|
|
902 |
//
|
|
903 |
TInt CPhoneRingingToneSrvPlayerAO::ConstructPlayers()
|
|
904 |
{
|
|
905 |
PHONEUIVIEW_PRINT( "CPhoneRingingToneSrvPlayerAO::ConstructPlayers <" );
|
|
906 |
TRAPD( err, ConstructPlayersL() );
|
|
907 |
|
|
908 |
PHONEUIVIEW_PRINTF( "CPhoneRingingToneSrvPlayerAO::ConstructPlayers: err = %d", err );
|
|
909 |
PHONEUIVIEW_PRINT( "CPhoneRingingToneSrvPlayerAO::ConstructPlayers >" );
|
|
910 |
return err;
|
|
911 |
}
|
|
912 |
|
|
913 |
|
|
914 |
// -----------------------------------------------------------------------------
|
|
915 |
// CPhoneRingingToneSrvPlayerAO::ConstructPlayersL
|
|
916 |
// -----------------------------------------------------------------------------
|
|
917 |
//
|
|
918 |
void CPhoneRingingToneSrvPlayerAO::ConstructPlayersL()
|
|
919 |
{
|
|
920 |
PHONEUIVIEW_PRINT( "CPhoneRingingToneSrvPlayerAO::ConstructPlayersL <" );
|
|
921 |
if ( !iMdaServer )
|
|
922 |
{
|
|
923 |
iMdaServer = CMdaServer::NewL();
|
|
924 |
}
|
|
925 |
|
|
926 |
// Construct Backup player.
|
|
927 |
if ( !iBackupPlayer )
|
|
928 |
{
|
|
929 |
TFileName defaultSoundFile( KDriveZ );
|
|
930 |
defaultSoundFile.Append( KPhoneDefaultSoundFile );
|
|
931 |
|
|
932 |
PHONEUIVIEW_PRINTF(
|
|
933 |
"CPhoneRingingToneSrvPlayerAO::ConstructPlayersL: construct backup player, path = %S",
|
|
934 |
&defaultSoundFile );
|
|
935 |
iBackupPlayer = CPhoneAudioPlayer::NewL(
|
|
936 |
defaultSoundFile,
|
|
937 |
KAudioPriorityPhoneCall,
|
|
938 |
KAudioPrefIncomingCall,
|
|
939 |
*this,
|
|
940 |
EPlayerBackup,
|
|
941 |
iMdaServer
|
|
942 |
);
|
|
943 |
}
|
|
944 |
|
|
945 |
PHONEUIVIEW_PRINT( "CPhoneRingingToneSrvPlayerAO::ConstructPlayersL >" );
|
|
946 |
}
|
|
947 |
|
|
948 |
// -----------------------------------------------------------------------------
|
|
949 |
// CPhoneRingingToneSrvPlayerAO::ConstructSequencePlayer
|
|
950 |
// -----------------------------------------------------------------------------
|
|
951 |
//
|
|
952 |
void CPhoneRingingToneSrvPlayerAO::ConstructSequencePlayer( TPlayerId aId )
|
|
953 |
{
|
|
954 |
PHONEUIVIEW_PRINT( "CPhoneRingingToneSrvPlayerAO::ConstructSequencePlayer" );
|
|
955 |
|
|
956 |
// Construct players.
|
|
957 |
TRAPD( err, ConstructSequencePlayerL( aId ) );
|
|
958 |
if ( err )
|
|
959 |
{
|
|
960 |
PHONEUIVIEW_PRINTF( "CPhoneRingingToneSrvPlayerAO::ConstructSequencePlayer - err(%d)", err );
|
|
961 |
}
|
|
962 |
}
|
|
963 |
|
|
964 |
// -----------------------------------------------------------------------------
|
|
965 |
// CPhoneRingingToneSrvPlayerAO::ConstructSequencePlayerL
|
|
966 |
// -----------------------------------------------------------------------------
|
|
967 |
//
|
|
968 |
void CPhoneRingingToneSrvPlayerAO::ConstructSequencePlayerL( TPlayerId aId )
|
|
969 |
{
|
|
970 |
PHONEUIVIEW_PRINT( "CPhoneRingingToneSrvPlayerAO::ConstructSequencePlayerL <" );
|
|
971 |
|
|
972 |
// Construct beep once player
|
|
973 |
if ( aId == EPlayerBeepOnce )
|
|
974 |
{
|
|
975 |
#ifdef __WINS__
|
|
976 |
TParse* fp = new (ELeave) TParse();
|
|
977 |
fp->Set( KPhoneBeepOnceSoundFile, &KDC_RESOURCE_FILES_DIR, NULL );
|
|
978 |
TFileName fileName( fp->FullName() );
|
|
979 |
delete fp;
|
|
980 |
|
|
981 |
iBeepOncePlayer = CPhoneAudioPlayer::NewL(
|
|
982 |
fileName,
|
|
983 |
KAudioPriorityPhoneCall,
|
|
984 |
KAudioPrefIncomingCall,
|
|
985 |
*this,
|
|
986 |
EPlayerBeepOnce );
|
|
987 |
#else
|
|
988 |
iBeepOncePlayer = CPhoneAudioPlayer::NewSeqL(
|
|
989 |
KPhoneBeepSequence(),
|
|
990 |
KAudioPriorityPhoneCall,
|
|
991 |
KAudioPrefIncomingCall,
|
|
992 |
*this,
|
|
993 |
EPlayerBeepOnce );
|
|
994 |
#endif // __WINS__
|
|
995 |
}
|
|
996 |
|
|
997 |
// Construct Silent Player.
|
|
998 |
else if ( aId == EPlayerSilent )
|
|
999 |
{
|
|
1000 |
#ifdef __WINS__
|
|
1001 |
TParse* fp = new (ELeave) TParse();
|
|
1002 |
fp->Set( KPhoneSilentSoundFile, &KDC_RESOURCE_FILES_DIR, NULL );
|
|
1003 |
TFileName fileName( fp->FullName() );
|
|
1004 |
delete fp;
|
|
1005 |
|
|
1006 |
iSilentPlayer = CPhoneAudioPlayer::NewL(
|
|
1007 |
fileName,
|
|
1008 |
KAudioPriorityPhoneCall,
|
|
1009 |
KAudioPrefIncomingCall,
|
|
1010 |
*this,
|
|
1011 |
EPlayerSilent );
|
|
1012 |
#else
|
|
1013 |
iSilentPlayer = CPhoneAudioPlayer::NewSeqL(
|
|
1014 |
KPhoneNoSoundSequence(),
|
|
1015 |
KAudioPriorityPhoneCall,
|
|
1016 |
KAudioPrefIncomingCall,
|
|
1017 |
*this,
|
|
1018 |
EPlayerSilent );
|
|
1019 |
#endif // __WINS__
|
|
1020 |
}
|
|
1021 |
// Construct unsecure VoIP tone player.
|
|
1022 |
else if ( aId == EPlayerUnsecureVoIP )
|
|
1023 |
{
|
|
1024 |
#ifdef __WINS__
|
|
1025 |
TParse* fp = new (ELeave) TParse();
|
|
1026 |
fp->Set( KPhoneBeepOnceSoundFile, &KDC_RESOURCE_FILES_DIR, NULL );
|
|
1027 |
TFileName fileName( fp->FullName() );
|
|
1028 |
delete fp;
|
|
1029 |
|
|
1030 |
iUnsecureVoIPTonePlayer = CPhoneAudioPlayer::NewL(
|
|
1031 |
fileName,
|
|
1032 |
KAudioPrioritySpecialInformationTone,
|
|
1033 |
KAudioPrefSpecialInformation,
|
|
1034 |
*this,
|
|
1035 |
EPlayerUnsecureVoIP );
|
|
1036 |
#else
|
|
1037 |
iUnsecureVoIPTonePlayer = CPhoneAudioPlayer::NewSeqL(
|
|
1038 |
KPhoneUnsecureVoIPCall(),
|
|
1039 |
KAudioPrioritySpecialInformationTone,
|
|
1040 |
KAudioPrefSpecialInformation,
|
|
1041 |
*this,
|
|
1042 |
EPlayerUnsecureVoIP );
|
|
1043 |
#endif // __WINS__
|
|
1044 |
}
|
|
1045 |
|
|
1046 |
PHONEUIVIEW_PRINT( "CPhoneRingingToneSrvPlayerAO::ConstructSequencePlayerL >" );
|
|
1047 |
}
|
|
1048 |
|
|
1049 |
// -----------------------------------------------------------------------------
|
|
1050 |
// CPhoneRingingToneSrvPlayerAO::CleanupPlayers
|
|
1051 |
// -----------------------------------------------------------------------------
|
|
1052 |
//
|
|
1053 |
void CPhoneRingingToneSrvPlayerAO::CleanupPlayers()
|
|
1054 |
{
|
|
1055 |
PHONEUIVIEW_PRINT( "CPhoneRingingToneSrvPlayerAO::CleanupPlayers <" );
|
|
1056 |
|
|
1057 |
delete iAudioPlayer;
|
|
1058 |
iAudioPlayer = NULL;
|
|
1059 |
|
|
1060 |
delete iDefaultPlayer;
|
|
1061 |
iDefaultPlayer = NULL;
|
|
1062 |
|
|
1063 |
delete iBeepOncePlayer;
|
|
1064 |
iBeepOncePlayer = NULL;
|
|
1065 |
|
|
1066 |
delete iSilentPlayer;
|
|
1067 |
iSilentPlayer = NULL;
|
|
1068 |
|
|
1069 |
delete iUnsecureVoIPTonePlayer;
|
|
1070 |
iUnsecureVoIPTonePlayer = NULL;
|
|
1071 |
|
|
1072 |
delete iBackupPlayer;
|
|
1073 |
iBackupPlayer = NULL;
|
|
1074 |
|
|
1075 |
delete iMdaServer;
|
|
1076 |
iMdaServer = NULL;
|
|
1077 |
|
|
1078 |
PHONEUIVIEW_PRINT( "CPhoneRingingToneSrvPlayerAO::CleanupPlayers >" );
|
|
1079 |
}
|
|
1080 |
|
|
1081 |
// -----------------------------------------------------------------------------
|
|
1082 |
// CPhoneRingingToneSrvPlayerAO::DeletePlayerAsync
|
|
1083 |
// -----------------------------------------------------------------------------
|
|
1084 |
//
|
|
1085 |
void CPhoneRingingToneSrvPlayerAO::DeletePlayerAsync( TPlayerId aPlayer )
|
|
1086 |
{
|
|
1087 |
PHONEUIVIEW_PRINTF( "CPhoneRingingToneSrvPlayerAO::DeletePlayerAsync(%d) <", aPlayer );
|
|
1088 |
|
|
1089 |
__ASSERT_DEBUG( aPlayer >= EPlayerFirst && aPlayer < iAsyncDeletePlayers.Count(),
|
|
1090 |
Panic( EPhoneViewInvariant ) );
|
|
1091 |
|
|
1092 |
// Player is not deleted here, but in RunL.
|
|
1093 |
Cancel();
|
|
1094 |
|
|
1095 |
if ( iAsyncDeletePlayers[ aPlayer ] )
|
|
1096 |
{
|
|
1097 |
delete iAsyncDeletePlayers[ aPlayer ];
|
|
1098 |
iAsyncDeletePlayers[ aPlayer ] = NULL;
|
|
1099 |
}
|
|
1100 |
|
|
1101 |
CPhoneAudioPlayer** players[] =
|
|
1102 |
{
|
|
1103 |
&iAudioPlayer,
|
|
1104 |
&iBeepOncePlayer,
|
|
1105 |
&iSilentPlayer,
|
|
1106 |
&iUnsecureVoIPTonePlayer,
|
|
1107 |
&iDefaultPlayer,
|
|
1108 |
&iBackupPlayer,
|
|
1109 |
&iTtsPlayer
|
|
1110 |
};
|
|
1111 |
|
|
1112 |
__ASSERT_DEBUG( iAsyncDeletePlayers.Count() > aPlayer, Panic( EPhoneUtilsIndexOutOfBounds ) );
|
|
1113 |
|
|
1114 |
iAsyncDeletePlayers[ aPlayer ] = *(players[ aPlayer ]);
|
|
1115 |
*(players[ aPlayer ]) = NULL;
|
|
1116 |
|
|
1117 |
iState = EDeletingAudioPlayer;
|
|
1118 |
|
|
1119 |
TRequestStatus* status = &iStatus;
|
|
1120 |
User::RequestComplete( status, KErrNone );
|
|
1121 |
SetActive();
|
|
1122 |
|
|
1123 |
PHONEUIVIEW_PRINTF( "CPhoneRingingToneSrvPlayerAO::DeletePlayerAsync(%d) >", aPlayer );
|
|
1124 |
}
|
|
1125 |
|
|
1126 |
// -----------------------------------------------------------------------------
|
|
1127 |
// CPhoneRingingToneSrvPlayerAO::RunL
|
|
1128 |
// -----------------------------------------------------------------------------
|
|
1129 |
//
|
|
1130 |
void CPhoneRingingToneSrvPlayerAO::RunL()
|
|
1131 |
{
|
|
1132 |
PHONEUIVIEW_PRINT( "CPhoneRingingToneSrvPlayerAO::RunL <" );
|
|
1133 |
|
|
1134 |
switch ( iState )
|
|
1135 |
{
|
|
1136 |
case EDeletingAudioPlayer:
|
|
1137 |
{
|
|
1138 |
for ( TInt i = EPlayerFirst; i <= EPlayerLast; i++ )
|
|
1139 |
{
|
|
1140 |
delete iAsyncDeletePlayers[ i ];
|
|
1141 |
iAsyncDeletePlayers[ i ] = NULL;
|
|
1142 |
}
|
|
1143 |
}
|
|
1144 |
break;
|
|
1145 |
|
|
1146 |
case EIdleState:
|
|
1147 |
default:
|
|
1148 |
break;
|
|
1149 |
} // switch iState
|
|
1150 |
|
|
1151 |
iState = EIdleState;
|
|
1152 |
|
|
1153 |
PHONEUIVIEW_PRINT( "CPhoneRingingToneSrvPlayerAO::RunL >" );
|
|
1154 |
}
|
|
1155 |
|
|
1156 |
// -----------------------------------------------------------------------------
|
|
1157 |
// CPhoneRingingToneSrvPlayerAO::DoCancel
|
|
1158 |
// -----------------------------------------------------------------------------
|
|
1159 |
//
|
|
1160 |
void CPhoneRingingToneSrvPlayerAO::DoCancel()
|
|
1161 |
{
|
|
1162 |
PHONEUIVIEW_PRINT( "CPhoneRingingToneSrvPlayerAO::DoCancel" );
|
|
1163 |
// Request is completed immediately before SetActive.
|
|
1164 |
}
|
|
1165 |
|
|
1166 |
// -----------------------------------------------------------------------------
|
|
1167 |
// CPhoneRingingToneSrvPlayerAO::HandleTtsDelayTimeout
|
|
1168 |
// -----------------------------------------------------------------------------
|
|
1169 |
//
|
|
1170 |
TInt CPhoneRingingToneSrvPlayerAO::HandleTtsDelayTimeout( TAny* aObject )
|
|
1171 |
{
|
|
1172 |
PHONEUIVIEW_PRINT( "CPhoneRingingToneSrvPlayerAO::HandleTtsDelayTimeout <" );
|
|
1173 |
static_cast<CPhoneRingingToneSrvPlayerAO*>( aObject )->
|
|
1174 |
DoHandleTtsDelayTimeout();
|
|
1175 |
|
|
1176 |
PHONEUIVIEW_PRINT( "CPhoneRingingToneSrvPlayerAO::HandleTtsDelayTimeout >" );
|
|
1177 |
return KErrNone;
|
|
1178 |
}
|
|
1179 |
|
|
1180 |
// -----------------------------------------------------------------------------
|
|
1181 |
// CPhoneRingingToneSrvPlayerAO::DoHandleTtsDelayTimeout
|
|
1182 |
// -----------------------------------------------------------------------------
|
|
1183 |
//
|
|
1184 |
void CPhoneRingingToneSrvPlayerAO::DoHandleTtsDelayTimeout()
|
|
1185 |
{
|
|
1186 |
PHONEUIVIEW_PRINT( "CPhoneRingingToneSrvPlayerAO::DoHandleTtsDelayTimeout()" );
|
|
1187 |
PHONEUIVIEW_PRINTF2(
|
|
1188 |
"CPhoneRingingToneSrvPlayerAO::DoHandleTtsDelayTimeout - iTtsRingingType(%d), iTTsTimeOutCounter(%d)",
|
|
1189 |
iTtsRingingType, iTTsTimeOutCounter );
|
|
1190 |
|
|
1191 |
CPhoneAudioPlayer* currPlayer = GetCurrentlyActiveAudioPlayerWithTTs();
|
|
1192 |
|
|
1193 |
if ( !currPlayer )
|
|
1194 |
{
|
|
1195 |
PHONEUIVIEW_PRINT( "CPhoneRingingToneSrvPlayerAO::DoHandleTtsDelayTimeout - null current player" );
|
|
1196 |
return;
|
|
1197 |
}
|
|
1198 |
TInt volume( 0 );
|
|
1199 |
//Ascending case. TTs player needs to be ascending.
|
|
1200 |
if ( iTtsRingingType == EProfileRingingTypeAscending )
|
|
1201 |
{
|
|
1202 |
//Volume needs to be different in different ascending steps
|
|
1203 |
PHONEUIVIEW_PRINT( "CPhoneRingingToneSrvPlayerAO::DoHandleTtsDelayTimeout - play ascending" );
|
|
1204 |
if ( !iTTsTimeOutCounter )
|
|
1205 |
{
|
|
1206 |
//We are saying callers name for the first time in ascending mode.
|
|
1207 |
//Say callers name by volume level KTtsVolumeMin.
|
|
1208 |
volume = KTtsVolumeMin;
|
|
1209 |
|
|
1210 |
iTtsPlayer->Play(
|
|
1211 |
ConvertRingingType( EProfileRingingTypeRingingOnce ),
|
|
1212 |
volume,
|
|
1213 |
iTtsToneToBePlayed );
|
|
1214 |
}
|
|
1215 |
else
|
|
1216 |
{
|
|
1217 |
//Checks the case that ringingtone is very quiet. Then do not play
|
|
1218 |
//TTS too loud
|
|
1219 |
volume = iTtsVolume < KTtsVolumeMin ? KTtsVolumeMin : KTtsVolumeAscendingRepeat;
|
|
1220 |
|
|
1221 |
//We are saying callers name for the second time in ascending mode.
|
|
1222 |
//Say callers name by volume level KTtsVolumeAscendingRepeat and decrease current players volume
|
|
1223 |
//to KPlayerVolumeAscendingRepeat. RampTime is zero
|
|
1224 |
currPlayer->SetNewVolumeAndRamptime( KPlayerVolumeAscendingRepeat, 0 );
|
|
1225 |
iTtsPlayer->Play(
|
|
1226 |
ConvertRingingType( EProfileRingingTypeRingingOnce ),
|
|
1227 |
volume,
|
|
1228 |
iTtsToneToBePlayed );
|
|
1229 |
}
|
|
1230 |
|
|
1231 |
}
|
|
1232 |
else //Normal ringing case.
|
|
1233 |
{
|
|
1234 |
PHONEUIVIEW_PRINT( "CPhoneRingingToneSrvPlayerAO::DoHandleTtsDelayTimeout - play normal" );
|
|
1235 |
currPlayer->SetNewVolumeAndRamptime( iTtsVolume-5, 0 );
|
|
1236 |
iTtsPlayer->Play(
|
|
1237 |
ConvertRingingType( EProfileRingingTypeRingingOnce ),
|
|
1238 |
iTtsVolume,
|
|
1239 |
iTtsToneToBePlayed );
|
|
1240 |
}
|
|
1241 |
|
|
1242 |
iTTsTimeOutCounter++;
|
|
1243 |
}
|
|
1244 |
|
|
1245 |
// -----------------------------------------------------------------------------
|
|
1246 |
// CPhoneRingingToneSrvPlayerAO::AddTtsPlaybackIfNeeded
|
|
1247 |
// -----------------------------------------------------------------------------
|
|
1248 |
//
|
|
1249 |
void CPhoneRingingToneSrvPlayerAO::AddTtsPlaybackIfNeeded(
|
|
1250 |
TProfileRingingType /*aRingingType*/ )
|
|
1251 |
{
|
|
1252 |
PHONEUIVIEW_PRINT( "CPhoneRingingToneSrvPlayerAO::AddTtsPlaybackIfNeeded" );
|
|
1253 |
if ( iTtsToneToBePlayed )
|
|
1254 |
{
|
|
1255 |
iTtsDelayIndex = 0;
|
|
1256 |
iTtsDelaysCount = KPhoneTtsDelaysCount;
|
|
1257 |
}
|
|
1258 |
}
|
|
1259 |
|
|
1260 |
// -----------------------------------------------------------------------------
|
|
1261 |
// CPhoneRingingToneSrvPlayerAO::ExtendedSecurity
|
|
1262 |
// -----------------------------------------------------------------------------
|
|
1263 |
//
|
|
1264 |
TBool CPhoneRingingToneSrvPlayerAO::ExtendedSecurity() const
|
|
1265 |
{
|
|
1266 |
PHONEUIVIEW_PRINTF( "CPhoneRingingToneSrvPlayerAO::ExtendedSecurity: %d", iExtSecNeeded );
|
|
1267 |
return iExtSecNeeded;
|
|
1268 |
}
|
|
1269 |
|
|
1270 |
// -----------------------------------------------------------------------------
|
|
1271 |
// CPhoneRingingToneSrvPlayerAO::SolveNewVolumeAndRamptime
|
|
1272 |
// -----------------------------------------------------------------------------
|
|
1273 |
//
|
|
1274 |
void CPhoneRingingToneSrvPlayerAO::SolveNewVolumeAndRamptime( TTtsStatus aStatus )
|
|
1275 |
{
|
|
1276 |
PHONEUIVIEW_PRINT( "CPhoneRingingToneSrvPlayerAO::SolveNewVolumeAndRamptime <" );
|
|
1277 |
|
|
1278 |
CPhoneAudioPlayer* currPlayer = NULL;
|
|
1279 |
currPlayer = GetCurrentlyActiveAudioPlayerWithTTs();
|
|
1280 |
if ( !currPlayer )
|
|
1281 |
{
|
|
1282 |
PHONEUIVIEW_PRINT( "CPhoneRingingToneSrvPlayerAO::SolveNewVolumeAndRamptime - null current player" );
|
|
1283 |
return;
|
|
1284 |
}
|
|
1285 |
TInt ramptime( 0 );
|
|
1286 |
//Here is handled the cases when Callers name is said. Sequence is:
|
|
1287 |
//3 sec. tone + name + 4 sec. tone + name +the tone until the end.
|
|
1288 |
switch ( aStatus )
|
|
1289 |
{
|
|
1290 |
case ESaidOnce:
|
|
1291 |
if ( iTtsRingingType == EProfileRingingTypeAscending )
|
|
1292 |
{
|
|
1293 |
//The ramptime could be ( 4 )* KPhoneTtsAscendingStep but now
|
|
1294 |
//we are setting this to 0 because when Say callers name is said
|
|
1295 |
//for first time: play ringing tone on level 3 for four secs.
|
|
1296 |
ramptime = 0;
|
|
1297 |
PHONEUIVIEW_PRINTF(
|
|
1298 |
"CPhoneRingingToneSrvPlayerAO::SolveNewVolumeAndRamptime - said once ascending - ramptime(%d)",
|
|
1299 |
ramptime );
|
|
1300 |
currPlayer->SetNewVolumeAndRamptime( KPlayerVolumeAscendingRepeat, ramptime );
|
|
1301 |
}
|
|
1302 |
else
|
|
1303 |
{
|
|
1304 |
//Normal ringingtone case. Adjust volume back to profile level.
|
|
1305 |
PHONEUIVIEW_PRINTF(
|
|
1306 |
"CPhoneRingingToneSrvPlayerAO::SolveNewVolumeAndRamptime - said once normal - ramptime(%d)",
|
|
1307 |
ramptime );
|
|
1308 |
currPlayer->SetNewVolumeAndRamptime( iTtsVolume, 0 );
|
|
1309 |
}
|
|
1310 |
break;
|
|
1311 |
|
|
1312 |
case ESaidTwice:
|
|
1313 |
if ( iTtsRingingType == EProfileRingingTypeAscending )
|
|
1314 |
{
|
|
1315 |
TInt vol = iTtsVolume;
|
|
1316 |
if ( vol > KPlayerVolumeAscendingRepeat )
|
|
1317 |
{
|
|
1318 |
vol = vol - KTtsVolumeAscendingDecrease;
|
|
1319 |
}
|
|
1320 |
|
|
1321 |
//TTS playing complete for second time. increase tone player volume.
|
|
1322 |
ramptime = ( vol )*KPhoneTtsAscendingStep;
|
|
1323 |
PHONEUIVIEW_PRINTF(
|
|
1324 |
"CPhoneRingingToneSrvPlayerAO::SolveNewVolumeAndRamptime - said twice ascending - ramptime(%d)",
|
|
1325 |
ramptime );
|
|
1326 |
currPlayer->SetNewVolumeAndRamptime( iTtsVolume, ramptime );
|
|
1327 |
}
|
|
1328 |
else
|
|
1329 |
{
|
|
1330 |
//Normal ringingtone case. Adjust volume back to profile level.
|
|
1331 |
PHONEUIVIEW_PRINTF(
|
|
1332 |
"CPhoneRingingToneSrvPlayerAO::SolveNewVolumeAndRamptime - said twice normal - ramptime(%d)",
|
|
1333 |
ramptime );
|
|
1334 |
currPlayer->SetNewVolumeAndRamptime( iTtsVolume, 0 );
|
|
1335 |
}
|
|
1336 |
break;
|
|
1337 |
|
|
1338 |
default:
|
|
1339 |
break;
|
|
1340 |
}
|
|
1341 |
}
|
|
1342 |
|
|
1343 |
|
|
1344 |
// -----------------------------------------------------------------------------
|
|
1345 |
// CPhoneRingingToneSrvPlayerAO::GetCurrentlyActiveAudioPlayerWithTTs
|
|
1346 |
// -----------------------------------------------------------------------------
|
|
1347 |
//
|
|
1348 |
CPhoneAudioPlayer*
|
|
1349 |
CPhoneRingingToneSrvPlayerAO::GetCurrentlyActiveAudioPlayerWithTTs()
|
|
1350 |
{
|
|
1351 |
PHONEUIVIEW_PRINT( "CPhoneRingingToneSrvPlayerAO::GetCurrentlyActiveAudioPlayerWithTTs" );
|
|
1352 |
|
|
1353 |
if( iAudioPlayer )
|
|
1354 |
{
|
|
1355 |
PHONEUIVIEW_PRINT( "CPhoneRingingToneSrvPlayerAO::GetCurrentlyActiveAudioPlayerWithTTs - audio player" );
|
|
1356 |
return iAudioPlayer;
|
|
1357 |
}
|
|
1358 |
else if ( iDefaultPlayer )
|
|
1359 |
{
|
|
1360 |
PHONEUIVIEW_PRINT( "CPhoneRingingToneSrvPlayerAO::GetCurrentlyActiveAudioPlayerWithTTs - default player" );
|
|
1361 |
return iDefaultPlayer;
|
|
1362 |
}
|
|
1363 |
else if( iBackupPlayer )
|
|
1364 |
{
|
|
1365 |
PHONEUIVIEW_PRINT( "CPhoneRingingToneSrvPlayerAO::GetCurrentlyActiveAudioPlayerWithTTs - backup player" );
|
|
1366 |
return iBackupPlayer;
|
|
1367 |
}
|
|
1368 |
else
|
|
1369 |
{
|
|
1370 |
return NULL;
|
|
1371 |
}
|
|
1372 |
}
|
|
1373 |
|
|
1374 |
// -----------------------------------------------------------------------------
|
|
1375 |
// CPhoneRingingToneSrvPlayerAO::ReStartRingingTonePlayer
|
|
1376 |
// -----------------------------------------------------------------------------
|
|
1377 |
//
|
|
1378 |
void CPhoneRingingToneSrvPlayerAO::ReStartRingingTonePlayer()
|
|
1379 |
{
|
|
1380 |
PHONEUIVIEW_PRINT( "CPhoneRingingToneSrvPlayerAO::ReStartRingingTonePlayer <" );
|
|
1381 |
|
|
1382 |
//First get currently active player which plays among TTS player.
|
|
1383 |
CPhoneAudioPlayer* currPlayer = NULL;
|
|
1384 |
currPlayer = GetCurrentlyActiveAudioPlayerWithTTs();
|
|
1385 |
if ( currPlayer )
|
|
1386 |
{
|
|
1387 |
currPlayer->ReStartPlaying();
|
|
1388 |
}
|
|
1389 |
|
|
1390 |
PHONEUIVIEW_PRINT( "CPhoneRingingToneSrvPlayerAO::ReStartRingingTonePlayer >" );
|
|
1391 |
}
|
|
1392 |
|
|
1393 |
// -----------------------------------------------------------------------------
|
|
1394 |
// CPhoneRingingToneSrvPlayerAO::CheckAndHandleToneSizeLimit
|
|
1395 |
// -----------------------------------------------------------------------------
|
|
1396 |
//
|
|
1397 |
TBool CPhoneRingingToneSrvPlayerAO::CheckAndHandleToneSizeLimit(
|
|
1398 |
CPhoneRingingTone* aRingingTone )
|
|
1399 |
{
|
|
1400 |
PHONEUIVIEW_PRINT( "CPhoneRingingToneSrvPlayerAO::CheckAndHandleToneSizeLimit" );
|
|
1401 |
TBool bValidSize = ETrue;
|
|
1402 |
|
|
1403 |
// If user has somehow managed to get a too large file as ringing tone,
|
|
1404 |
// play default tone instead.
|
|
1405 |
if ( iToneFileSizeLimitKB )
|
|
1406 |
{
|
|
1407 |
if ( CheckToneFileSize( aRingingTone->FileName(), iToneFileSizeLimitKB) != KErrNone )
|
|
1408 |
{
|
|
1409 |
bValidSize = EFalse;
|
|
1410 |
}
|
|
1411 |
}
|
|
1412 |
PHONEUIVIEW_PRINTF( "CPhoneRingingToneSrvPlayerAO::CheckAndHandleToneSizeLimit - bValidSize(%d)", bValidSize );
|
|
1413 |
return bValidSize;
|
|
1414 |
}
|
|
1415 |
|
|
1416 |
// -----------------------------------------------------------------------------
|
|
1417 |
// CPhoneRingingToneSrvPlayerAO::CheckToneFileSize
|
|
1418 |
// -----------------------------------------------------------------------------
|
|
1419 |
//
|
|
1420 |
TInt CPhoneRingingToneSrvPlayerAO::CheckToneFileSize( const TDesC& aFile, TInt aSizeLimitKB )
|
|
1421 |
{
|
|
1422 |
PHONEUIVIEW_PRINT( "CPhoneRingingToneSrvPlayerAO::CheckToneFileSize" );
|
|
1423 |
|
|
1424 |
// Get file size
|
|
1425 |
TInt size = 0;
|
|
1426 |
TInt error = KErrNone;
|
|
1427 |
|
|
1428 |
TEntry entry;
|
|
1429 |
if ( KErrNone == iFs.Entry( aFile, entry ))
|
|
1430 |
{
|
|
1431 |
size = entry.iSize;
|
|
1432 |
}
|
|
1433 |
|
|
1434 |
// Check
|
|
1435 |
aSizeLimitKB *= Kkilo;
|
|
1436 |
if ( aSizeLimitKB && size > aSizeLimitKB )
|
|
1437 |
{
|
|
1438 |
error = KErrTooBig;
|
|
1439 |
}
|
|
1440 |
|
|
1441 |
PHONEUIVIEW_PRINTF( "CPhoneRingingToneSrvPlayerAO::CheckToneFileSize: size = %d", size );
|
|
1442 |
return error;
|
|
1443 |
}
|
|
1444 |
|
|
1445 |
|
|
1446 |
// -----------------------------------------------------------------------------
|
|
1447 |
// CPhoneRingingToneSrvPlayerAO::ActiveAudioPlayer
|
|
1448 |
// -----------------------------------------------------------------------------
|
|
1449 |
//
|
|
1450 |
CPhoneAudioPlayer* CPhoneRingingToneSrvPlayerAO::ActiveAudioPlayer()
|
|
1451 |
{
|
|
1452 |
PHONEUIVIEW_PRINT( "CPhoneRingingToneSrvPlayerAO::ActiveAudioPlayer" );
|
|
1453 |
|
|
1454 |
switch( iTonePlayingStatus )
|
|
1455 |
{
|
|
1456 |
case EAudioTonePlaying:
|
|
1457 |
if ( iAudioPlayer )
|
|
1458 |
{
|
|
1459 |
return iAudioPlayer;
|
|
1460 |
}
|
|
1461 |
break;
|
|
1462 |
|
|
1463 |
case EDefaultTonePlaying:
|
|
1464 |
if ( iDefaultPlayer )
|
|
1465 |
{
|
|
1466 |
return iDefaultPlayer;
|
|
1467 |
}
|
|
1468 |
break;
|
|
1469 |
|
|
1470 |
case EBeepOnce:
|
|
1471 |
if ( iBeepOncePlayer )
|
|
1472 |
{
|
|
1473 |
return iBeepOncePlayer;
|
|
1474 |
}
|
|
1475 |
break;
|
|
1476 |
|
|
1477 |
case EBackupTonePlaying:
|
|
1478 |
if ( iBackupPlayer )
|
|
1479 |
{
|
|
1480 |
return iBackupPlayer;
|
|
1481 |
}
|
|
1482 |
break;
|
|
1483 |
|
|
1484 |
case ESilentTonePlaying:
|
|
1485 |
if ( iSilentPlayer )
|
|
1486 |
{
|
|
1487 |
return iSilentPlayer;
|
|
1488 |
}
|
|
1489 |
break;
|
|
1490 |
|
|
1491 |
case EUnsecureVoIPTonePlaying:
|
|
1492 |
if ( iUnsecureVoIPTonePlayer )
|
|
1493 |
{
|
|
1494 |
return iUnsecureVoIPTonePlayer;
|
|
1495 |
}
|
|
1496 |
break;
|
|
1497 |
|
|
1498 |
default:
|
|
1499 |
break;
|
|
1500 |
}
|
|
1501 |
|
|
1502 |
return NULL;
|
|
1503 |
}
|
|
1504 |
|
|
1505 |
|
|
1506 |
// -----------------------------------------------------------------------------
|
|
1507 |
// CPhoneRingingToneSrvPlayerAO::SetExtendedSecurityNeeded
|
|
1508 |
// -----------------------------------------------------------------------------
|
|
1509 |
//
|
|
1510 |
void CPhoneRingingToneSrvPlayerAO::SetExtendedSecurityNeeded( TBool aNeeded )
|
|
1511 |
{
|
|
1512 |
PHONEUIVIEW_PRINTF( "CPhoneRingingToneSrvPlayerAO::SetExtendedSecurityNeeded: %d", aNeeded );
|
|
1513 |
|
|
1514 |
iExtSecNeeded = aNeeded;
|
|
1515 |
}
|
|
1516 |
|
|
1517 |
// -----------------------------------------------------------------------------
|
|
1518 |
// CPhoneRingingToneSrvPlayerAO::SetToneFileSizeLimit
|
|
1519 |
// -----------------------------------------------------------------------------
|
|
1520 |
//
|
|
1521 |
void CPhoneRingingToneSrvPlayerAO::SetToneFileSizeLimit( TInt aLimit )
|
|
1522 |
{
|
|
1523 |
PHONEUIVIEW_PRINTF( "CPhoneRingingToneSrvPlayerAO::SetToneFileSizeLimit: %d", aLimit );
|
|
1524 |
|
|
1525 |
iToneFileSizeLimitKB = aLimit;
|
|
1526 |
}
|
|
1527 |
|
|
1528 |
// -----------------------------------------------------------------------------
|
|
1529 |
// CPhoneRingingToneSrvPlayerAO::SetRingingToneL
|
|
1530 |
// -----------------------------------------------------------------------------
|
|
1531 |
//
|
|
1532 |
void CPhoneRingingToneSrvPlayerAO::SetRingingToneL( const TDesC& aFilename )
|
|
1533 |
{
|
|
1534 |
PHONEUIVIEW_PRINTF( "CPhoneRingingToneSrvPlayerAO::SetRingingToneL: %S", &aFilename );
|
|
1535 |
|
|
1536 |
if ( !iAudioVideoRingingTone )
|
|
1537 |
{
|
|
1538 |
iAudioVideoRingingTone = CPhoneRingingTone::NewL( aFilename );
|
|
1539 |
}
|
|
1540 |
else if ( iAudioVideoRingingTone->FileName().Compare( aFilename ) )
|
|
1541 |
{
|
|
1542 |
iAudioVideoRingingTone->SetFileName( aFilename );
|
|
1543 |
}
|
|
1544 |
}
|
|
1545 |
|
|
1546 |
// -----------------------------------------------------------------------------
|
|
1547 |
// CPhoneRingingToneSrvPlayerAO::SetDefaultRingingToneL
|
|
1548 |
// -----------------------------------------------------------------------------
|
|
1549 |
//
|
|
1550 |
void CPhoneRingingToneSrvPlayerAO::SetDefaultRingingToneL( const TDesC& aFilename )
|
|
1551 |
{
|
|
1552 |
PHONEUIVIEW_PRINTF( "CPhoneRingingToneSrvPlayerAO::SetDefaultRingingToneL: %S", &aFilename );
|
|
1553 |
|
|
1554 |
if ( !iDefaultRingingTone )
|
|
1555 |
{
|
|
1556 |
iDefaultRingingTone = CPhoneRingingTone::NewL( aFilename );
|
|
1557 |
}
|
|
1558 |
else if ( iDefaultRingingTone->FileName().Compare( aFilename ) )
|
|
1559 |
{
|
|
1560 |
iDefaultRingingTone->SetFileName( aFilename );
|
|
1561 |
}
|
|
1562 |
}
|
|
1563 |
|
|
1564 |
// End of File
|