|
1 /* |
|
2 * Copyright (c) 2006-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: ?Description |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 /* --------------------------------------------------------------------------- |
|
20 * Version history: |
|
21 * Template version: |
|
22 * <ccm_history> |
|
23 * |
|
24 * Version: 19, Fri Sep 19 13:00:00 2008 by Rohit |
|
25 * Ref: |
|
26 * Added ASF detection and Integrated CIRAsfPlayer in Now Playing scenario |
|
27 * |
|
28 * </ccm_history> |
|
29 * ============================================================================ |
|
30 */ |
|
31 |
|
32 #include <internetradio.rsg> |
|
33 #include <stringloader.h> |
|
34 #include <aknwaitdialog.h> |
|
35 |
|
36 #include "irnowplayingwrapper.h" |
|
37 #include "irmainview.h" |
|
38 #include "irdebug.h" |
|
39 #include "irstreamsource.h" |
|
40 #include "irmediaclient.h" |
|
41 #include "irctrlcmdobserver.h" |
|
42 #include "irsessionlogger.h" |
|
43 #include "irsettings.h" |
|
44 #include "irisdswrapper.h" |
|
45 #include "irmetadata.h" |
|
46 #include "irisdspreset.h" |
|
47 #include "irautomatedbitrateselection.h" // KHighQuality defined |
|
48 #include "irdialoglauncher.h" |
|
49 #include "ircommon.h" |
|
50 #include "irui.h" |
|
51 #include "irpubsub.h" |
|
52 #include "irstreamsourceerrors.h"//KIRStreamSourceTimeOut defined |
|
53 #include "irnowplayingview.h" |
|
54 #include "ir.hrh" |
|
55 #include "irnetworkcontroller.h" |
|
56 #include "irhistory.h" |
|
57 #include "irplsview.h" |
|
58 #include "irnetworkcontrollerobserver.h" |
|
59 #include "irasfplayer.h" // CIRAsfPlayer |
|
60 #include <mmfcontrollerpluginresolver.h> //to get the supported MIME types |
|
61 #include "irmainview.h" |
|
62 #include "irmaincontainer.h" |
|
63 #include "iractivenetworkobserver.h" |
|
64 #include "irreportsettings.h" |
|
65 |
|
66 const TInt KTemporaryUrlMaxLength = 256; |
|
67 const TInt KUrlbufMaxLength = 256; |
|
68 //No of volume level is 10 + 1 level 1 level is mute |
|
69 const TInt KNOVOLUMELEVELS =10; |
|
70 |
|
71 |
|
72 _LIT(KConst," "); |
|
73 // --------------------------------------------------------------------------- |
|
74 // CIRNowPlayingWrapper* CIRNowPlayingWrapper::NewL() |
|
75 // function to return an instance of CIRNowPlayingWrapper |
|
76 // Two phase constructor |
|
77 // --------------------------------------------------------------------------- |
|
78 // |
|
79 CIRNowPlayingWrapper* CIRNowPlayingWrapper::NewL(CIRUi& aAppUi,CIRSettings& aIRSettings, |
|
80 CIRIsdsWrapper& aIsdsWrapper) |
|
81 { |
|
82 IRLOG_DEBUG( "CIRNowPlayingWrapper::NewL - Entering" ); |
|
83 CIRNowPlayingWrapper* self = CIRNowPlayingWrapper::NewLC(aAppUi,aIRSettings,aIsdsWrapper); |
|
84 CleanupStack::Pop(self); |
|
85 IRLOG_DEBUG( "CIRNowPlayingWrapper::NewL - Exiting." ); |
|
86 return self; |
|
87 } |
|
88 |
|
89 // --------------------------------------------------------------------------- |
|
90 // CIRNowPlayingWrapper* CIRNowPlayingWrapper::NewLC() |
|
91 // Two-phased constructor. |
|
92 // Create a CIRNowPlayingWrapper object, which will draw itself |
|
93 // to aRect. |
|
94 // --------------------------------------------------------------------------- |
|
95 // |
|
96 CIRNowPlayingWrapper* CIRNowPlayingWrapper::NewLC(CIRUi& aAppUi,CIRSettings& aIRSettings, |
|
97 CIRIsdsWrapper& aIsdsWrapper) |
|
98 { |
|
99 IRLOG_DEBUG( "CIRNowPlayingWrapper::NewLC - Entering" ); |
|
100 CIRNowPlayingWrapper* self = new (ELeave) CIRNowPlayingWrapper(aAppUi,aIRSettings,aIsdsWrapper); |
|
101 CleanupStack::PushL(self); |
|
102 self->ConstructL(); |
|
103 IRLOG_DEBUG( "CIRNowPlayingWrapper::NewLC - Exiting." ); |
|
104 return self; |
|
105 } |
|
106 |
|
107 // --------------------------------------------------------------------------- |
|
108 // CIRNowPlayingWrapper::~CIRNowPlayingWrapper() |
|
109 // Destructor. |
|
110 // --------------------------------------------------------------------------- |
|
111 // |
|
112 CIRNowPlayingWrapper:: ~CIRNowPlayingWrapper() |
|
113 { |
|
114 IRLOG_DEBUG( "CIRNowPlayingWrapper::~CIRNowPlayingWrapper - Entering" ); |
|
115 if(iNetwork) |
|
116 { |
|
117 delete iNetwork; |
|
118 iNetwork = NULL; |
|
119 } |
|
120 iAppUi.GetNowPlayingViewInstance()->DeleteSteroEffect(EFalse); |
|
121 if(iPlayer) |
|
122 { |
|
123 delete iPlayer; |
|
124 iPlayer = NULL; |
|
125 } |
|
126 if(iChannel) |
|
127 { |
|
128 delete iChannel; |
|
129 iChannel = NULL; |
|
130 } |
|
131 if( iReportGenerator ) |
|
132 { |
|
133 iReportGenerator->Close(); |
|
134 } |
|
135 if(iMetaData) |
|
136 { |
|
137 delete iMetaData; |
|
138 iMetaData = NULL; |
|
139 } |
|
140 if(iNowPlayingPreset) |
|
141 { |
|
142 delete iNowPlayingPreset; |
|
143 iNowPlayingPreset = NULL; |
|
144 } |
|
145 if(iEditStationPreset) |
|
146 { |
|
147 delete iEditStationPreset; |
|
148 iEditStationPreset = NULL; |
|
149 } |
|
150 if(iWaitDialog) |
|
151 { |
|
152 delete iWaitDialog; |
|
153 iWaitDialog = NULL; |
|
154 } |
|
155 if(iURLArray) |
|
156 { |
|
157 delete iURLArray; |
|
158 iURLArray = NULL; |
|
159 } |
|
160 iAppUi.iNetworkController->DeleteActiveNetworkObserver(*this); |
|
161 |
|
162 if( iAsfPlayer ) |
|
163 { |
|
164 delete iAsfPlayer; |
|
165 iAsfPlayer = NULL; |
|
166 iAsfStreaming = EFalse; |
|
167 } |
|
168 IRLOG_DEBUG( "CIRNowPlayingWrapper::~CIRNowPlayingWrapper - Exiting" ); |
|
169 } |
|
170 // --------------------------------------------------------------------------- |
|
171 // void CIRNowPlayingWrapper::ConstructL() |
|
172 // Constructs the |
|
173 // --------------------------------------------------------------------------- |
|
174 // |
|
175 |
|
176 void CIRNowPlayingWrapper::ConstructL() |
|
177 { |
|
178 IRLOG_DEBUG( "CIRNowPlayingWrapper::ConstructL - Entering" ); |
|
179 //Instantiate StreamSource |
|
180 iNetwork = CIRStreamSource::NewL(*this); |
|
181 |
|
182 //command channel object creation it is through this component |
|
183 //media engine interacts with UI |
|
184 iChannel = CIRCtrlCmdObserver::NewL(this,iNetwork); |
|
185 |
|
186 //media cient object creation |
|
187 iPlayer = CIRMediaClient::NewL(iChannel); |
|
188 |
|
189 //Session Log |
|
190 iReportGenerator = CIRReportGenerator::OpenL(); |
|
191 |
|
192 iMetaData = CIRMetaData::NewL(); |
|
193 |
|
194 //Instantiate ISDS Preset |
|
195 iNowPlayingPreset=CIRIsdsPreset::NewL(); |
|
196 |
|
197 iEditStationPreset = CIRIsdsPreset::NewL(); |
|
198 |
|
199 //currently not playing |
|
200 iPlaying = EFalse; |
|
201 |
|
202 //session log should not be terminated on loading cancel |
|
203 iTerminatedLogOnCancel = EFalse; |
|
204 |
|
205 // when skipping channels used for audio fadein fade out |
|
206 iAudioFadein = EFalse; |
|
207 |
|
208 // currently set to false since no session created |
|
209 iSessionShouldNotEnd = EFalse; |
|
210 |
|
211 // set when connect to channel server |
|
212 iConnectToServer = EFalse; |
|
213 |
|
214 // TO DO: need to remove this variable |
|
215 // set when stop is done from nowplayimng view |
|
216 iPlayandStop = EFalse; |
|
217 |
|
218 // Checks whether network connection has done |
|
219 iIsConnected = EFalse; |
|
220 |
|
221 // Waitdialog required for for showing buffering |
|
222 iWaitDialog = NULL; |
|
223 |
|
224 // The multiple url's of a channel are stored |
|
225 iURLArray = NULL; |
|
226 |
|
227 |
|
228 //Used For Now Playing View |
|
229 |
|
230 iDisplayMetaData=EFalse; |
|
231 |
|
232 iMarquee = EFalse; |
|
233 |
|
234 // The variable is set when player is not supported |
|
235 iPlayBack=ETrue; |
|
236 |
|
237 // The variable is set when called for cancel network request |
|
238 iCancelNetworkRequest=EFalse; |
|
239 |
|
240 // The variable is set when buffering waitdialog is deleted |
|
241 iDialogCanceled=EFalse; |
|
242 |
|
243 // Registering for network controller to get the notification |
|
244 // when network is lost or network connection is made |
|
245 iAppUi.iNetworkController->RegisterActiveNetworkObserverL(*this); |
|
246 |
|
247 // Required when Switching to network |
|
248 iNotify=EFalse; |
|
249 |
|
250 // Asf streaming |
|
251 iAsfPlayer = CIRAsfPlayer::NewL( *this, *this ); |
|
252 |
|
253 // Valuse set when a session is stared |
|
254 iSessionStartedFlag = EFalse; |
|
255 |
|
256 // This variable is set when listen from Isds is done |
|
257 iListenFromIsds=EFalse; |
|
258 |
|
259 // The variable checks whether the nowplaying view is active |
|
260 iLaunchNowplaying=EFalse; |
|
261 |
|
262 // The variable is required when user does buffering watdialog |
|
263 iBufferingRequestCancelled=EFalse; |
|
264 |
|
265 iPlaying=EFalse; |
|
266 iQualityRequired=-1; |
|
267 IRLOG_DEBUG( "CIRNowPlayingWrapper::ConstructL - Exiting" ); |
|
268 } |
|
269 |
|
270 // --------------------------------------------------------------------------- |
|
271 // void CIRNowPlayingWrapper::CIRNowPlayingWrapper() |
|
272 // Default Constructor |
|
273 // --------------------------------------------------------------------------- |
|
274 // |
|
275 CIRNowPlayingWrapper::CIRNowPlayingWrapper(CIRUi& aAppUi,CIRSettings& aIRSettings, |
|
276 CIRIsdsWrapper& aIsdsWrapper):iIRSettings(aIRSettings), |
|
277 iIsdsWrapper(aIsdsWrapper),iAppUi(aAppUi), |
|
278 iAsfPlayer(NULL), iAsfStreaming(EFalse) |
|
279 { |
|
280 IRLOG_DEBUG( "CIRNowPlayingWrapper::CIRNowPlayingWrapper - Entering" ); |
|
281 iSessionStart=EFalse; |
|
282 iChannelConnect=EFalse; |
|
283 IRLOG_DEBUG( "CIRNowPlayingWrapper::NewLC - Exiting" ); |
|
284 } |
|
285 |
|
286 // --------------------------------------------------------------------------- |
|
287 // MIRStreamSourceObserver::OpenComplete() |
|
288 // Called when connected to the channel server To implement the fill of buffer |
|
289 // --------------------------------------------------------------------------- |
|
290 // |
|
291 void CIRNowPlayingWrapper::OpenComplete() |
|
292 { |
|
293 //once a buffer is completed this api is called as |
|
294 //callback |
|
295 IRLOG_DEBUG("CIRNowPlayingWrapper::OpenComplete - Entering" ); |
|
296 |
|
297 /**** ASF streaming changes : begin ****/ |
|
298 if(!iAsfStreaming) |
|
299 { |
|
300 iPlayer->BufferFilled(); |
|
301 } |
|
302 /**** ASF streaming changes : begin ****/ |
|
303 |
|
304 IRLOG_DEBUG("CIRNowPlayingWrapper::OpenComplete - Exiting." ); |
|
305 } |
|
306 // --------------------------------------------------------------------------- |
|
307 // MIRStreamSourceObserver::ErrorConnecting() |
|
308 // Called when there is an error when connecting to the channel server @Param aErrorCode Indicates the type of error as described in irstreamsourceerrors.h--------------------------------------------------------------------------- |
|
309 // --------------------------------------------------------------------------- |
|
310 // |
|
311 void CIRNowPlayingWrapper::ErrorConnecting(TInt aErrorCode) |
|
312 { |
|
313 IRLOG_DEBUG2( "CIRNowPlayingWrapper::ErrorConnecting(aErrorCode=%d)", aErrorCode ); |
|
314 iChannelConnect = EFalse; |
|
315 // this method fails only if display of info note fails which can be |
|
316 // ignored so we use TRAP_IGNORE |
|
317 |
|
318 TRAP_IGNORE(DoErrorConnectingL(aErrorCode)) |
|
319 |
|
320 IRLOG_DEBUG( "CIRNowPlayingWrapper::ErrorConnecting - Exiting." ); |
|
321 } |
|
322 // --------------------------------------------------------------------------- |
|
323 // MIRStreamSourceObserver::PlayNow() |
|
324 // Called to indicate to the player to start playing |
|
325 // --------------------------------------------------------------------------- |
|
326 // |
|
327 void CIRNowPlayingWrapper::PlayNow() |
|
328 { |
|
329 IRLOG_INFO( "CIRNowPlayingWrapper::PlayNow - Entering" ); |
|
330 |
|
331 DoPlayingStateChanged( ETrue ); |
|
332 |
|
333 //sets the configuration data |
|
334 TConfig config; |
|
335 //by default takes the volume from data base |
|
336 //that is when the player is not currently playing |
|
337 config.iVolume = iIRSettings.GetVolumeSetting(); |
|
338 //if current playing we have to do audio fade in. |
|
339 //So we set the volume as zero |
|
340 if(iAudioFadein) |
|
341 { |
|
342 config.iVolume = 0; |
|
343 } |
|
344 TRAPD(err,iPlayer->StartNewPlayerL(config,iNetwork->ContentTypeL())) |
|
345 if( err ) |
|
346 { |
|
347 IRLOG_ERROR2( "CIRNowPlayingWrapper::PlayNow - Starting new player failed (err=%d)", err ); |
|
348 //if error occurs in occurs, displaying |
|
349 TRAP_IGNORE( |
|
350 DisplayErrorNoteL(R_IRAPP_IRGENERAL_ERROR); |
|
351 ) |
|
352 } |
|
353 IRLOG_DEBUG( "CIRNowPlayingWrapper::PlayNow - Exiting." ); |
|
354 } |
|
355 // --------------------------------------------------------------------------- |
|
356 // MIRStreamSourceObserver::Play() |
|
357 // Triggers the play after reconnecting to the channel |
|
358 // --------------------------------------------------------------------------- |
|
359 // |
|
360 void CIRNowPlayingWrapper::Play() |
|
361 { |
|
362 IRLOG_INFO( "CIRNowPlayingWrapper::Play - Entering" ); |
|
363 //play is called |
|
364 iUrl.Copy(iLastPlayedUrl); |
|
365 TInt err = iPlayer->Play(); |
|
366 |
|
367 if( err ) |
|
368 { |
|
369 IRLOG_ERROR2( "CIRNowPlayingWrapper::Play - Play failed (err=%d), starting new player.", err ); |
|
370 TConfig config; |
|
371 config.iVolume = iIRSettings.GetVolumeSetting(); |
|
372 TRAPD(err2,iPlayer->StartNewPlayerL(config,iNetwork->ContentTypeL())) |
|
373 if( err2 ) |
|
374 { |
|
375 IRLOG_ERROR2( "CIRNowPlayingWrapper::Play - Starting new player failed (err=%d)", err2 ); |
|
376 //if error occurs in occurs, displaying |
|
377 TRAP_IGNORE( |
|
378 DisplayErrorNoteL(R_IRAPP_IRGENERAL_ERROR); |
|
379 ) |
|
380 } |
|
381 } |
|
382 IRLOG_DEBUG("CIRNowPlayingWrapper::Play - Exiting." ); |
|
383 } |
|
384 // --------------------------------------------------------------------------- |
|
385 // MIRStreamSourceObserver::StopBuffering() |
|
386 // Called to indicate to the player to stop buffering |
|
387 // --------------------------------------------------------------------------- |
|
388 // |
|
389 void CIRNowPlayingWrapper::StopBuffering() |
|
390 { |
|
391 IRLOG_INFO( "CIRNowPlayingWrapper::StopBuffering - Entering" ); |
|
392 |
|
393 /**** ASF streaming changes : begin ****/ |
|
394 if(!iAsfStreaming) |
|
395 iPlayer->StopMediaBuffering(); |
|
396 /**** ASF streaming changes : end ****/ |
|
397 |
|
398 IRLOG_INFO( "CIRNowPlayingWrapper::StopBuffering - Exiting. " ); |
|
399 } |
|
400 // --------------------------------------------------------------------------- |
|
401 // MIRStreamSourceObserver::ConnectionEstablished(TInt aFeedValue) |
|
402 // Called to indicate that the connection to channel server is sucessful |
|
403 // --------------------------------------------------------------------------- |
|
404 // |
|
405 void CIRNowPlayingWrapper::ConnectionEstablished() |
|
406 { |
|
407 IRLOG_INFO( "CIRNowPlayingWrapper::ConnectionEstablished - Entering." ); |
|
408 // Reset channel connection request |
|
409 TInt bitRate; |
|
410 //To Do:Commented code for accp channel |
|
411 /*if( iReConnecting ) |
|
412 { |
|
413 iProgress=EFalse; |
|
414 } |
|
415 // The control only for the first initial buffering |
|
416 // not while reconnecting to same channel i.e, while play & stop. |
|
417 // TO Do: here check is dine only for aacp player |
|
418 // All content types should be checked |
|
419 |
|
420 _LIT(KAudiContent,"aacp");//aacp |
|
421 RBuf content; |
|
422 TRAP_IGNORE(content.Create(iNetwork->ContentTypeL().Length());) |
|
423 TRAP_IGNORE(content.Copy(iNetwork->ContentTypeL());) |
|
424 TInt MimeType1= content.Find(KAudiContent); |
|
425 if(MimeType1!=KErrNotFound) |
|
426 { |
|
427 TInt returnValue=0; |
|
428 TRAP_IGNORE(returnValue=GetSupportedMimeTypeL()); |
|
429 if(returnValue==KErrNotFound) |
|
430 { |
|
431 iCancelNetworkRequest = ETrue; |
|
432 iURLCount++; |
|
433 if(iURLCount>=iURLArray->MdcaCount()) |
|
434 { |
|
435 MCtrlCommand(EError,KErrNotSupported); |
|
436 content.Close(); |
|
437 return; |
|
438 } |
|
439 iNetwork->CancelRequest(); |
|
440 iDialogCanceled=EFalse; |
|
441 DoPlayingStateChanged( EFalse ); |
|
442 if(iURLArray->MdcaCount()) |
|
443 { |
|
444 //TRAP_IGNORE(CreateWaitDialogL()) |
|
445 TBuf8<KUrlbufMaxLength> urlbuf; |
|
446 urlbuf.Copy(iURLArray->MdcaPoint(iURLCount)); |
|
447 //connecting to a new channel so multiple URL selection enabled |
|
448 //that if current URL doesn't connect we will try to connect to |
|
449 //next URL in iURLArray |
|
450 iMultipleURLSelect = ETrue; |
|
451 iUnconnectedUrl.Copy(urlbuf); |
|
452 TRAPD(error,DoConnectToServerL(urlbuf)); |
|
453 if( error ) |
|
454 { |
|
455 IRLOG_ERROR2( "CIRNowPlayingWrapper::ConnectToChannel - DoConnectToServer failed (error=%d)", error ); |
|
456 TRAP_IGNORE( DisplayErrorNoteL(R_IRAPP_ERROR_CONNECTION) ) |
|
457 } |
|
458 content.Close(); |
|
459 return; |
|
460 } |
|
461 } |
|
462 } |
|
463 content.Close();*/ |
|
464 // here since the connection got established the value set to True |
|
465 iChannelConnected=ETrue; |
|
466 iLastConnectedPresetId = iNowPlayingPreset->GetId(); |
|
467 iLastConnectedPresetUniqId = iNowPlayingPreset->UniqId(); |
|
468 iChannelConnect = EFalse; |
|
469 //connecting to a new channel so multiple URL selection disabled |
|
470 //if we are able to connect to a particular URL we have to |
|
471 //disable trying to connect to next URLs since error conditions after this |
|
472 //are to handled differently |
|
473 iMultipleURLSelect = EFalse; |
|
474 if ( iLastConnectedUrl != iUrl ) |
|
475 { |
|
476 IRLOG_INFO( "CIRNowPlayingWrapper::ConnectionEstablished - Station URL changed, clearing history list and current meta data information" ); |
|
477 TRAP_IGNORE( ClearMetaDataL() ) |
|
478 } |
|
479 |
|
480 iLastConnectedUrl.Copy(iUrl); |
|
481 iReportGenerator->MarkSessionStart(); |
|
482 if( iSessionStart ) |
|
483 { |
|
484 // Next url to it is connected is logged. |
|
485 iReportGenerator->LogServerResult( iUrl, EIRConnected ); |
|
486 } |
|
487 |
|
488 //set the sync state as EPsConnectionSuccessful on a successful connection |
|
489 if( !iReConnecting ) |
|
490 { |
|
491 iProgress = ETrue; |
|
492 //session end is marked |
|
493 //iReportGenerator->MarkSessionStart() |
|
494 TRAP_IGNORE( |
|
495 TFileName pathtopost=iAppUi.GetPrivatePath(); |
|
496 pathtopost.Append(KGZipLogFileName); |
|
497 //if this api leaves it is ignored |
|
498 //we need not do any action if post fails |
|
499 //the application should be left unaffected |
|
500 if(!iNotify) |
|
501 iIsdsWrapper.GetISDSInstance()->IRISDSPostL(pathtopost); |
|
502 ) |
|
503 //starts audio fade out for the previous channel |
|
504 /**** ASF streaming changes : begin ****/ |
|
505 if(!iAsfStreaming) |
|
506 iChannel->DoAudioFadeOut(); |
|
507 /**** ASF streaming changes : end ****/ |
|
508 |
|
509 /*if(iSessionStart) |
|
510 { |
|
511 //next url to it is connected is logged |
|
512 iReportGenerator->LogServerResult(iUrl,EIRConnected); |
|
513 }*/ |
|
514 } |
|
515 else |
|
516 { |
|
517 // Value set to false becoz the the user is trying |
|
518 // to connect to same channel so need to update progress |
|
519 iProgress = EFalse; |
|
520 } |
|
521 // This part of code is needed In some cases |
|
522 // When channel is playing and In intial buffer content the bitrate value is Zero |
|
523 // So the bitate vaule is taken from the Preset Information and Subscibing |
|
524 iPlayBack=ETrue; |
|
525 RProperty::Get ( KUidActiveInternetRadioApp, KIRPSBitrate, bitRate ); |
|
526 if(bitRate==0) |
|
527 { |
|
528 |
|
529 TRAP_IGNORE(bitRate= iNowPlayingPreset->GetChannelBitrateL(iURLCount);) |
|
530 RProperty::Set ( KUidActiveInternetRadioApp, KIRPSBitrate, bitRate ); |
|
531 } |
|
532 if((iAppUi.GetNowPlayingViewInstance()->iContainer)) |
|
533 { |
|
534 iAppUi.GetNowPlayingViewInstance()->SetBitrate(EFalse); |
|
535 } |
|
536 IRLOG_DEBUG( "CIRNowPlayingWrapper::ConnectionEstablished - Exiting." ); |
|
537 } |
|
538 |
|
539 // --------------------------------------------------------------------------- |
|
540 // MIRStreamSourceObserver::UpdateProgress() |
|
541 // Called to provide teh buffer values @param aFeedValue used to pump the buffering value |
|
542 // --------------------------------------------------------------------------- |
|
543 // |
|
544 void CIRNowPlayingWrapper::UpdateProgress(TInt aFeedValue) |
|
545 { |
|
546 IRLOG_DEBUG( "CIRNowPlayingWrapper::UpdateProgress - Entering" ); |
|
547 if(iProgress) |
|
548 { |
|
549 if(!iIsdsWrapper.ActiveWaitDialog()) |
|
550 { |
|
551 RBuf Feed; |
|
552 HBufC* percent=NULL; |
|
553 TRAP_IGNORE(percent= StringLoader::LoadL(R_IRAPP_LOADING_BUFFERING_PERCENTAGE, aFeedValue);) |
|
554 Feed.Create(percent->Length()); |
|
555 Feed.Copy(*percent); |
|
556 delete percent; |
|
557 if(!iWaitDialog) |
|
558 { |
|
559 iWaitDialog = new CAknWaitDialog( NULL,ETrue); |
|
560 if(!iWaitDialog) |
|
561 { |
|
562 return; |
|
563 } |
|
564 else |
|
565 { |
|
566 iWaitDialog->SetCallback(this); |
|
567 TRAP_IGNORE(iWaitDialog->ExecuteLD(R_IRAPP_PROGRESS_DIALOG);) |
|
568 } |
|
569 } |
|
570 if(iWaitDialog) |
|
571 { |
|
572 TRAPD(err,iWaitDialog->SetTextL(Feed);) |
|
573 if(err!=KErrNone) |
|
574 { |
|
575 return; |
|
576 } |
|
577 } |
|
578 iBufferigSteamText=ETrue; |
|
579 Feed.Close(); |
|
580 } |
|
581 } |
|
582 IRLOG_DEBUG( "CIRNowPlayingWrapper::UpdateProgress - Exiting." ); |
|
583 } |
|
584 // --------------------------------------------------------------------------- |
|
585 // MCrtlCmdCommand::HandleMetaDataReceivedL() |
|
586 // Invoked when meta data is received. @param aMetaData The meta data that was received. |
|
587 // --------------------------------------------------------------------------- |
|
588 // |
|
589 void CIRNowPlayingWrapper::HandleMetaDataReceivedL( const CIRMetaData& aMetaData ) |
|
590 { |
|
591 IRLOG_DEBUG( "CIRNowPlayingWrapper::HandleMetaDataReceivedL - Entering" ); |
|
592 TBuf<KMAXMETABUFLENGTH> artist = aMetaData.Artist(); |
|
593 TBuf<KMAXMETABUFLENGTH> song = aMetaData.Song(); |
|
594 RemoveWhiteSpace( artist ); |
|
595 RemoveWhiteSpace( song ); |
|
596 iMetaData->SetArtistL( artist ); |
|
597 iMetaData->SetSongL( song ); |
|
598 |
|
599 if(iMetaData->Artist().Length() || iMetaData->Song().Length()) |
|
600 { |
|
601 if ((iAppUi.GetNowPlayingViewInstance()->iContainer )) |
|
602 { |
|
603 iMarquee=ETrue; |
|
604 iDisplayMetaData=EFalse; |
|
605 iAppUi.GetNowPlayingViewInstance()->DisplaySongArtistNameL( iMetaData->Song(), |
|
606 iMetaData->Artist() ); |
|
607 } |
|
608 // the history should get updated only when 100 persent buffering is done |
|
609 if(!iWaitDialog||iAppUi.iIsdsWrapper->GetListenRequest()) |
|
610 { |
|
611 PublishDataL(); |
|
612 } |
|
613 } |
|
614 IRLOG_DEBUG( "CIRNowPlayingWrapper::HandleMetaDataReceivedL - Exiting." ); |
|
615 } |
|
616 // --------------------------------------------------------------------------- |
|
617 // MCrtlCmdCommand::MCtrlCommand() |
|
618 // Function is pure virtual function which used to pass commands @param TIRControlCommmand represents the commands,which determines what action to be taken |
|
619 // @param aValue represents any integer value if any, like buffering percentage |
|
620 // --------------------------------------------------------------------------- |
|
621 // |
|
622 void CIRNowPlayingWrapper::MCtrlCommand( TIRControlCommmand aCommand, TInt aValue ) |
|
623 { |
|
624 IRLOG_INFO3( "CIRNowPlayingWrapper::MCtrlCommand (aCommand=%d, aValue=%d)", aCommand, aValue ); |
|
625 switch (aCommand) |
|
626 { |
|
627 case EBufferFillStart: |
|
628 { |
|
629 //TO Do:: This is needed for future Use |
|
630 |
|
631 break; |
|
632 } |
|
633 |
|
634 case EBufferFillStop: |
|
635 { |
|
636 TRAP_IGNORE(DestroyWaitDialogL()); |
|
637 DoPlayingStateChanged( ETrue ); |
|
638 iBufferingRequestCancelled=EFalse; |
|
639 iDialogCanceled=EFalse; |
|
640 iPlayBack=ETrue; |
|
641 if(iNowPlayingPreset->GetChannelType()) |
|
642 { |
|
643 iUinqid=iNowPlayingPreset->UniqId(); |
|
644 } |
|
645 if(iAppUi.ActiveView() == KIRMainChoiceViewID) |
|
646 { |
|
647 TRAP_IGNORE(iAppUi.iMainView->GetMainContainer()->UpdateAllL();) |
|
648 } |
|
649 // publish the play status |
|
650 RProperty::Set( KUidActiveInternetRadioApp,KIRPSMultiplePlay, |
|
651 iAppUi.GetCurrentThreadIDValue()); |
|
652 if( iSessionStart ) |
|
653 { |
|
654 iReportGenerator->HandleStopEvents(ETrue); |
|
655 } |
|
656 if( iProgress ) |
|
657 { |
|
658 //since we are able to connect to the URL the url is current streaming URL |
|
659 //implemented for the progress bar view |
|
660 iLastPlayedUrl.Copy(iLastConnectedUrl); |
|
661 //To publish the metadata |
|
662 TRAP_IGNORE(PublishDataL();) |
|
663 if(!iLaunchNowplaying && iNotify) |
|
664 { |
|
665 IRRDEBUG2("CIRNowPlayingWrapper::EBufferFillStop - iNotify", KNullDesC ); |
|
666 iProgress = EFalse; |
|
667 iLaunchNowplaying=EFalse; |
|
668 break; |
|
669 } |
|
670 iNotify=EFalse; |
|
671 //Activate NowPlayingView |
|
672 if(!iAppUi.GetNowPlayingViewInstance()->iContainer) |
|
673 { |
|
674 if(iContextViews==EHistoryView) |
|
675 { |
|
676 if(iAppUi.IsForeground()|| iAppUi.GetBgLock()) |
|
677 { |
|
678 TRAP_IGNORE(iAppUi.ActivateLocalViewL( KIRNowPlayingViewID, |
|
679 KHistoryLaunch,KIRNowPlayingViewCustomMessagePlayAfterActivation)); |
|
680 iAppUi.SetActivationPendingValue(KNullUid); |
|
681 } |
|
682 else |
|
683 { |
|
684 iAppUi.SetActivationPendingValue(KIRNowPlayingViewID); |
|
685 } |
|
686 } |
|
687 else if(iContextViews==EFav||iContextViews==ELastplayed) |
|
688 { |
|
689 _LIT8(KNull,""); |
|
690 if(iAppUi.IsForeground()|| iAppUi.GetBgLock()) |
|
691 { |
|
692 TRAP_IGNORE(iAppUi.ActivateLocalViewL( KIRNowPlayingViewID, |
|
693 KNowPlayingFrmMainView,KNull);) |
|
694 iAppUi.iActivationPending = KNullUid ; |
|
695 } |
|
696 else |
|
697 { |
|
698 iAppUi.SetActivationPendingValue(KIRNowPlayingViewID); |
|
699 } |
|
700 } |
|
701 else |
|
702 { |
|
703 if ( iAppUi.IsForeground()|| iAppUi.GetBgLock()) |
|
704 { |
|
705 iAppUi.SetActivationPendingValue(KNullUid); |
|
706 TRAP_IGNORE(iAppUi.ActivateLocalViewL(KIRNowPlayingViewID)) |
|
707 } |
|
708 else |
|
709 { |
|
710 iAppUi.SetActivationPendingValue(KIRNowPlayingViewID); |
|
711 } |
|
712 } |
|
713 } |
|
714 iProgress = EFalse; |
|
715 } |
|
716 else |
|
717 { |
|
718 IRRDEBUG2("CIRNowPlayingWrapper::DestroyWaitDialogLiProgress Entering", KNullDesC); |
|
719 TRAP_IGNORE(DestroyWaitDialogL()); |
|
720 TRAP_IGNORE(PublishDataL();) |
|
721 iAppUi.GetNowPlayingViewInstance()->SetsameUrlFlag(ETrue); |
|
722 DoPlayingStateChanged( ETrue ); |
|
723 if(iAppUi.GetPlayStateWhileCall()) |
|
724 { |
|
725 iAppUi.SetPlayStateWhileCall(EFalse); |
|
726 break; |
|
727 } |
|
728 if(iPlayandStop) |
|
729 { |
|
730 iPlayandStop=EFalse; |
|
731 if(!iAppUi.GetNowPlayingViewInstance()->iContainer) |
|
732 { |
|
733 if(iContextViews==EHistoryView) |
|
734 { |
|
735 TRAP_IGNORE(iAppUi.ActivateLocalViewL( KIRNowPlayingViewID, |
|
736 KHistoryLaunch,KIRNowPlayingViewCustomMessagePlayAfterActivation);) |
|
737 } |
|
738 else if(iContextViews==EFav||iContextViews==ELastplayed) |
|
739 { |
|
740 _LIT8(KNull,""); |
|
741 TRAP_IGNORE(iAppUi.ActivateLocalViewL( KIRNowPlayingViewID, |
|
742 KNowPlayingFrmMainView,KNull);) |
|
743 } |
|
744 else |
|
745 { |
|
746 if ( iAppUi.IsForeground() || iAppUi.GetBgLock() ) |
|
747 { |
|
748 TRAP_IGNORE(iAppUi.ActivateLocalViewL(KIRNowPlayingViewID)) |
|
749 } |
|
750 } |
|
751 } |
|
752 } |
|
753 else if(iAppUi.IsCallActive()||iAppUi.GetAlarm()) |
|
754 { |
|
755 if(!iAppUi.GetNowPlayingViewInstance()->iContainer) |
|
756 { |
|
757 if(iContextViews==EHistoryView) |
|
758 { |
|
759 TRAP_IGNORE(iAppUi.ActivateLocalViewL( KIRNowPlayingViewID, |
|
760 KHistoryLaunch,KIRNowPlayingViewCustomMessagePlayAfterActivation);) |
|
761 } |
|
762 else if(iContextViews==EFav) |
|
763 { |
|
764 _LIT8(KNull,""); |
|
765 TRAP_IGNORE(iAppUi.ActivateLocalViewL( KIRNowPlayingViewID, |
|
766 KNowPlayingFrmMainView,KNull);) |
|
767 } |
|
768 else |
|
769 { |
|
770 if ( iAppUi.IsForeground() || iAppUi.GetBgLock() ) |
|
771 { |
|
772 TRAP_IGNORE(iAppUi.ActivateLocalViewL(KIRNowPlayingViewID)) |
|
773 } |
|
774 } |
|
775 } |
|
776 } |
|
777 } |
|
778 iAppUi.GetPubSubManagerInstance()->PublishBufferingState(EIRStateBufferingStop); |
|
779 IRRDEBUG2("CIRNowPlayingWrapper::EBufferFillStop Exit", KNullDesC); |
|
780 |
|
781 break; |
|
782 } |
|
783 |
|
784 case EBufferFilling: |
|
785 { |
|
786 //no implementation |
|
787 break; |
|
788 } |
|
789 |
|
790 case EBufferFadeOut: |
|
791 { |
|
792 //for fade out volume is updated |
|
793 SetAudioVolume(aValue); |
|
794 break; |
|
795 } |
|
796 |
|
797 case EBufferFadeIn: |
|
798 { |
|
799 //for fade in volume is updated |
|
800 SetAudioVolume(aValue); |
|
801 break; |
|
802 } |
|
803 |
|
804 case EStoppedPlaying: |
|
805 { |
|
806 |
|
807 if(iPlaying) |
|
808 { |
|
809 iAudioFadein=ETrue; |
|
810 } |
|
811 |
|
812 if( iSessionStart ) |
|
813 { |
|
814 iReportGenerator->HandleStopEvents(EFalse); |
|
815 } |
|
816 if ( !iProgress || aValue != KErrDied ) |
|
817 { |
|
818 if( !iAppUi.GetAlarm() && !iAppUi.IsCallActive() && aValue != KErrDied ) |
|
819 { |
|
820 iNetwork->CancelRequest(); |
|
821 } |
|
822 } |
|
823 |
|
824 TBool returnValue = EFalse; |
|
825 #ifndef __WINS__ |
|
826 TRAP_IGNORE( ( returnValue = CheckCallStatusL() ) ) |
|
827 #endif |
|
828 if(!returnValue) |
|
829 { |
|
830 DoPlayingStateChanged( EFalse ); |
|
831 } |
|
832 if(iAppUi.ActiveView() == KIRMainChoiceViewID) |
|
833 { |
|
834 TRAP_IGNORE(iAppUi.iMainView->GetMainContainer()->UpdateAllL();) |
|
835 } |
|
836 |
|
837 break; |
|
838 } |
|
839 |
|
840 case EBufferFadeInReady: |
|
841 { |
|
842 //start audio fade in |
|
843 if(iAudioFadein && (!iAppUi.GetNowPlayingViewInstance()->IsVolumeMuted())) |
|
844 { |
|
845 TIRControlCommmand command = EBufferFadeIn; |
|
846 TInt volume=0; |
|
847 volume = iIRSettings.GetVolumeSetting(); |
|
848 iChannel->AudioFadeInOut(command,volume); |
|
849 iAudioFadein = EFalse; |
|
850 } |
|
851 break; |
|
852 } |
|
853 case EStereo: |
|
854 { |
|
855 if(iAppUi.GetNowPlayingViewInstance()) |
|
856 { |
|
857 iAppUi.GetNowPlayingViewInstance()->DeleteSteroEffect(ETrue); |
|
858 } |
|
859 break; |
|
860 } |
|
861 case EPlayingState: |
|
862 { |
|
863 if(iAppUi.GetNowPlayingViewInstance()) |
|
864 { |
|
865 iAppUi.GetNowPlayingViewInstance()->DisablePlayer(); |
|
866 } |
|
867 } |
|
868 break; |
|
869 case EError: |
|
870 { |
|
871 if( ( KErrNotSupported == aValue ) || ( KErrNotFound == aValue ) |
|
872 ||(KIRCtrlCmdPlayerNotCreated==aValue) ) |
|
873 { |
|
874 //iURLCount++ |
|
875 //Handling Radio Playback Failed |
|
876 if(iURLArray->MdcaCount()>0) |
|
877 { |
|
878 TRAP_IGNORE(DestroyWaitDialogL()); |
|
879 DoPlayingStateChanged( EFalse ); |
|
880 if( iSessionStart ) |
|
881 { |
|
882 iReportGenerator->LogServerResult(iUrl,EIRConnFailed); |
|
883 iReportGenerator->HandleStopEvents(EFalse); |
|
884 //update current operator |
|
885 iReportGenerator->UpdateCurrentNetwork(iAppUi.GetCurrentOperatorValue()); |
|
886 iReportGenerator->UpdateNmsCurrentNetwork(iAppUi.GetCurrentOperatorValue()); |
|
887 //update home operator |
|
888 iReportGenerator->UpdateHomeOperator(iAppUi.GetHomeOperatorValue()); |
|
889 iReportGenerator->UpdateNmsHomeOperator(iAppUi.GetHomeOperatorValue()); |
|
890 |
|
891 TTerminationStatus terminationstatus = EUserTerminated; |
|
892 //and the cause of error |
|
893 iReportGenerator->UpdateTerminatedBy(terminationstatus); |
|
894 //session ends due to error |
|
895 TRAP_IGNORE(iReportGenerator->SessionEndL(EFalse);) |
|
896 iSessionStart=EFalse; |
|
897 iSessionShouldNotEnd = EFalse;//check |
|
898 } |
|
899 iPlayBack=EFalse; |
|
900 if(!iProgress) |
|
901 { |
|
902 iNetwork->CancelRequest(); |
|
903 if(iAppUi.GetNowPlayingViewInstance()->iContainer) |
|
904 { |
|
905 iLastPlayedUrl.Copy(iUnconnectedUrl); |
|
906 iLastConnectedUrl.Copy(iUnconnectedUrl); |
|
907 iLastPlayedUrl.Copy(iUnconnectedUrl); |
|
908 } |
|
909 else |
|
910 { |
|
911 iUrl.Delete(0,iUrl.Length()); |
|
912 iLastConnectedUrl.Zero(); |
|
913 iLastPlayedUrl.Zero(); |
|
914 } |
|
915 } |
|
916 else |
|
917 { |
|
918 //reset the view to a proper view during the error conditions |
|
919 HandlePlayError(); |
|
920 } |
|
921 if((iAppUi.GetNowPlayingViewInstance()->iContainer)) |
|
922 { |
|
923 iAppUi.GetNowPlayingViewInstance()->SetBitrate(EFalse); |
|
924 } |
|
925 //if error occurs in player an error note is displayed |
|
926 TRAP_IGNORE( |
|
927 DisplayErrorNoteL(R_IRAPP_PLAY_FAIL_ERROR); |
|
928 ) |
|
929 } |
|
930 } |
|
931 } |
|
932 break; |
|
933 |
|
934 default: |
|
935 { |
|
936 break; |
|
937 } |
|
938 } |
|
939 IRLOG_DEBUG( "CIRNowPlayingWrapper::MCtrlCommand - Exiting."); |
|
940 } |
|
941 // --------------------------------------------------------------------------- |
|
942 // MCrtlCmdCommand::FetchVolume() |
|
943 // Function is pure virtual function which sents Request to get the current volume index |
|
944 // @return volume index |
|
945 // --------------------------------------------------------------------------- |
|
946 // |
|
947 TInt CIRNowPlayingWrapper::FetchVolume() |
|
948 { |
|
949 //gets the volume from the settings |
|
950 IRLOG_DEBUG( "CIRNowPlayingWrapper::FetchVolume" ); |
|
951 TInt volume=0; |
|
952 volume=iIRSettings.GetVolumeSetting(); |
|
953 return volume ; |
|
954 } |
|
955 // --------------------------------------------------------------------------- |
|
956 // MCrtlCmdCommand::DoAudioFadeOut() |
|
957 // Function is pure virtual function, it is used to sent request start audio Fade Out |
|
958 // --------------------------------------------------------------------------- |
|
959 // |
|
960 void CIRNowPlayingWrapper::DoAudioFadeOut() |
|
961 { |
|
962 //triggers audio fade out |
|
963 IRLOG_DEBUG2( "CIRNowPlayingWrapper::DoAudioFadeOut - iAudioFadein=%d", iAudioFadein ); |
|
964 if(iAudioFadein) |
|
965 { |
|
966 TIRControlCommmand command = EBufferFadeOut; |
|
967 TInt volume=0; |
|
968 volume= iIRSettings.GetVolumeSetting(); |
|
969 iChannel->AudioFadeInOut(command,volume); |
|
970 } |
|
971 IRLOG_DEBUG( "CIRNowPlayingWrapper::DoAudioFadeOut - Exiting." ); |
|
972 } |
|
973 // --------------------------------------------------------------------------- |
|
974 // MCrtlCmdCommand::PlayerChanged() |
|
975 // Function is pure virtual function which sents Request to get the current volume index |
|
976 // @return volume index |
|
977 // --------------------------------------------------------------------------- |
|
978 // |
|
979 void CIRNowPlayingWrapper::PlayerChanged() |
|
980 { |
|
981 if(iAppUi.GetNowPlayingViewInstance()) |
|
982 { |
|
983 |
|
984 TRAP_IGNORE(iAppUi.GetNowPlayingViewInstance()->GetStereoModeL();) |
|
985 } |
|
986 } |
|
987 |
|
988 // --------------------------------------------------------------------------- |
|
989 // CIRNowPlayingWrapper::ConnectToChannel() |
|
990 // This function is called to connect to a particular channel |
|
991 // This function will obtain the multiple urls into an array |
|
992 // connects to the first url in the array |
|
993 // --------------------------------------------------------------------------- |
|
994 // |
|
995 void CIRNowPlayingWrapper::ConnectToChannelL(CIRIsdsPreset& aPreset) |
|
996 { |
|
997 IRLOG_DEBUG( "CIRNowPlayingWrapper::ConnectToChannel - Entering" ); |
|
998 iCheckValue=EFalse; |
|
999 iDialogCanceled=EFalse; |
|
1000 iPlayandStop=ETrue; |
|
1001 iSyncPreset=EFalse; |
|
1002 if(iQualityRequired!=-1 && iURLArray->MdcaCount()!=1 && !iPlaying ) |
|
1003 { |
|
1004 TInt qualityrequired; |
|
1005 switch(iAppUi.iNetworkController->IdentifyConnectionType()) |
|
1006 { |
|
1007 case EGprs: // Falls through. |
|
1008 case EEdge: |
|
1009 { |
|
1010 //if GPRS network get the selection |
|
1011 qualityrequired = iIRSettings.GetGPRSBitrateQuality(); |
|
1012 } |
|
1013 break; |
|
1014 case EWcdma: |
|
1015 case ECdma2000: |
|
1016 { |
|
1017 //if 3G network get the selection |
|
1018 qualityrequired = iIRSettings.Get3GBitrateQuality(); |
|
1019 } |
|
1020 break; |
|
1021 |
|
1022 case EWiFi: |
|
1023 { |
|
1024 //if WiFi network get the selection |
|
1025 qualityrequired = iIRSettings.GetWiFiBitrateQuality(); |
|
1026 } |
|
1027 break; |
|
1028 default: |
|
1029 { |
|
1030 //if WiFi network get the selection |
|
1031 qualityrequired = iIRSettings.GetWiFiBitrateQuality(); |
|
1032 } |
|
1033 break; |
|
1034 } |
|
1035 if(iQualityRequired!=qualityrequired) |
|
1036 { |
|
1037 iLastConnectedUrl.Zero(); |
|
1038 } |
|
1039 } |
|
1040 //getting the URLs from the preset according to the preset |
|
1041 SelectUrlUsingBitRateL(aPreset); |
|
1042 TBuf8<KUrlbufMaxLength> urlbuf; |
|
1043 TBuf<KMaxUrlSize> CheckLastConnected; |
|
1044 iURLCount = 0; |
|
1045 if ( iURLArray->MdcaCount() > 0 ) |
|
1046 { |
|
1047 urlbuf.Copy(iURLArray->MdcaPoint(iURLCount)); |
|
1048 //connecting to a new channel so multiple URL selection enabled |
|
1049 //that if current URL doesn't connect we will try to connect to |
|
1050 //next URL in iURLArray |
|
1051 iMultipleURLSelect = ETrue; |
|
1052 iUnconnectedUrl.Copy(urlbuf); |
|
1053 for(TInt i=0;i<iURLArray->MdcaCount() && !iCheckValue;i++) |
|
1054 { |
|
1055 CheckLastConnected.Copy(iURLArray->MdcaPoint(i)); |
|
1056 if(iLastConnectedUrl.Compare(CheckLastConnected)==0) |
|
1057 { |
|
1058 if(iPlaying||(iUinqid==iNowPlayingPreset->UniqId())||(iURLArray->MdcaCount()==1)) |
|
1059 { |
|
1060 iCheckValue=ETrue; |
|
1061 } |
|
1062 if(iPlaying) |
|
1063 { |
|
1064 DestroyWaitDialogL(); |
|
1065 } |
|
1066 } |
|
1067 } |
|
1068 if(iNotify) |
|
1069 { |
|
1070 iDialogCanceled=EFalse; |
|
1071 if(!iIsdsWrapper.ActiveWaitDialog()) |
|
1072 CreateWaitDialogL(); |
|
1073 iAppUi.GetPubSubManagerInstance()->PublishBufferingState(EIRStateBufferingStart); |
|
1074 |
|
1075 if(iAppUi.ActiveView() == KIRMainChoiceViewID) |
|
1076 { |
|
1077 iAppUi.iMainView->GetMainContainer()->UpdateAllL(); |
|
1078 } |
|
1079 iReConnecting=EFalse; |
|
1080 TRAPD(error,DoConnectToServerL(urlbuf)); |
|
1081 if( error ) |
|
1082 { |
|
1083 IRLOG_ERROR2( "CIRNowPlayingWrapper::ConnectToChannel - DoConnectToServer failed (error=%d)", error ); |
|
1084 TRAP_IGNORE( DisplayErrorNoteL(R_IRAPP_ERROR_CONNECTION) ) |
|
1085 } |
|
1086 } |
|
1087 else |
|
1088 { |
|
1089 if((iAppUi.GetNowPlayingViewInstance()->iContainer)) |
|
1090 { |
|
1091 iLaunchNowplaying=ETrue; |
|
1092 } |
|
1093 if(!iCheckValue) |
|
1094 { |
|
1095 iLastConnectedUrl.Zero(); |
|
1096 CheckLastConnected.Zero(); |
|
1097 if((iAppUi.GetNowPlayingViewInstance()->iContainer)) |
|
1098 { |
|
1099 iAppUi.GetNowPlayingViewInstance()->SetsameUrlFlag(EFalse); |
|
1100 } |
|
1101 if(iPlaying && !iProgress) |
|
1102 { |
|
1103 #ifndef __WINS__ |
|
1104 StopBuffering(); |
|
1105 /**** ASF streaming changes : begin ****/ |
|
1106 if(!iAsfStreaming) |
|
1107 { |
|
1108 iPlayer->Stop(); |
|
1109 } |
|
1110 else |
|
1111 { |
|
1112 iAsfStreaming = EFalse; |
|
1113 iAsfPlayer->Stop(); |
|
1114 } |
|
1115 if(iSessionStart) |
|
1116 { |
|
1117 //update current operator |
|
1118 iReportGenerator->UpdateCurrentNetwork(iAppUi.GetCurrentOperatorValue()); |
|
1119 iReportGenerator->UpdateNmsCurrentNetwork(iAppUi.GetCurrentOperatorValue()); |
|
1120 //update home operator |
|
1121 iReportGenerator->UpdateHomeOperator(iAppUi.GetHomeOperatorValue()); |
|
1122 iReportGenerator->UpdateNmsHomeOperator(iAppUi.GetHomeOperatorValue()); |
|
1123 |
|
1124 TTerminationStatus terminationstatus = EUserTerminated; |
|
1125 //and the cause of error |
|
1126 iReportGenerator->UpdateTerminatedBy(terminationstatus); |
|
1127 //session ends due to error |
|
1128 iReportGenerator->SessionEndL(EFalse); |
|
1129 iSessionStart=EFalse; |
|
1130 } |
|
1131 |
|
1132 /**** ASF streaming changes : end ****/ |
|
1133 #endif //__WINS__ |
|
1134 } |
|
1135 if(iContextViews==EFav||iContextViews==EPls|| |
|
1136 iContextViews==EHistoryView||iContextViews==ELastplayed) |
|
1137 { |
|
1138 CreateWaitDialogL(); |
|
1139 iAppUi.GetPubSubManagerInstance()->PublishBufferingState(EIRStateBufferingStart); |
|
1140 } |
|
1141 if(iAppUi.ActiveView() == KIRMainChoiceViewID) |
|
1142 { |
|
1143 iAppUi.iMainView->GetMainContainer()->UpdateAllL(); |
|
1144 } |
|
1145 DoConnectToServerL(urlbuf); |
|
1146 } |
|
1147 else if(iCheckValue) |
|
1148 { |
|
1149 urlbuf.Copy(CheckLastConnected); |
|
1150 iUnconnectedUrl.Copy(CheckLastConnected); |
|
1151 if(iAppUi.ActiveView() == KIRMainChoiceViewID) |
|
1152 { |
|
1153 iAppUi.iMainView->GetMainContainer()->UpdateAllL(); |
|
1154 } |
|
1155 |
|
1156 TRAPD(error,DoConnectToServerL(urlbuf)); |
|
1157 if( error ) |
|
1158 { |
|
1159 IRLOG_ERROR2( "CIRNowPlayingWrapper::ConnectToChannel - DoConnectToServer failed (error=%d)", error ); |
|
1160 TRAP_IGNORE( DisplayErrorNoteL(R_IRAPP_ERROR_CONNECTION) ) |
|
1161 } |
|
1162 } |
|
1163 } |
|
1164 } |
|
1165 if(iContextViews==EFav) |
|
1166 { |
|
1167 TInt passId=iAppUi.GetFavPresetsInstance()->SearchPreset( iNowPlayingPreset->GetId(), |
|
1168 iNowPlayingPreset->UniqId()); |
|
1169 // Checks for the preset index of the channel, if preset index exists |
|
1170 // in favourites list, publishes the preset index. |
|
1171 if( passId != KErrNotFound) |
|
1172 { |
|
1173 TInt presetIndex = passId+1; |
|
1174 RProperty::Set( KUidActiveInternetRadioApp, KIRPSPresetIndex, |
|
1175 presetIndex ); |
|
1176 } |
|
1177 else |
|
1178 { |
|
1179 // If preset not present in favourites list, publishes the index |
|
1180 // as 0. This is set to 0 here to indicate the active idle |
|
1181 // component that the index with 0 is a non favourite channel. |
|
1182 TInt presetIndex = 0; |
|
1183 RProperty::Set( KUidActiveInternetRadioApp, KIRPSPresetIndex, |
|
1184 presetIndex ); |
|
1185 } |
|
1186 |
|
1187 |
|
1188 } |
|
1189 else |
|
1190 { |
|
1191 TInt presetIndex = 0; |
|
1192 RProperty::Set( KUidActiveInternetRadioApp, KIRPSPresetIndex, |
|
1193 presetIndex ); |
|
1194 } |
|
1195 |
|
1196 IRLOG_DEBUG( "CIRNowPlayingWrapper::ConnectToChannel - Exiting." ); |
|
1197 } |
|
1198 |
|
1199 // ------------------------------------------------------------------------- |
|
1200 // CIRNowPlayingWrapper::SelectUrlUsingBitRateL() |
|
1201 // Selects the proper URL based on settings of quality |
|
1202 // according to current network |
|
1203 // current network type is stored in iNetwork. gets the URLs in iURLArray |
|
1204 // --------------------------------------------------------------------------- |
|
1205 // |
|
1206 void CIRNowPlayingWrapper::SelectUrlUsingBitRateL(CIRIsdsPreset& aPreset) |
|
1207 { |
|
1208 IRLOG_DEBUG( "CIRNowPlayingWrapper::SelectUrlUsingBitRate - Entering" ); |
|
1209 #ifdef __WINS__ |
|
1210 if(iURLArray) |
|
1211 { |
|
1212 delete iURLArray; |
|
1213 iURLArray = NULL; |
|
1214 } |
|
1215 aPreset.SetUrlCount(); // remove build warning |
|
1216 _LIT(KWinUrl,"http://172.28.205.137:8000"); |
|
1217 iURLArray = new (ELeave) CDesCArrayFlat(1); |
|
1218 iURLArray->AppendL(KWinUrl); |
|
1219 #else |
|
1220 //by default we are setting quality as KHighQuality |
|
1221 TInt qualityrequired = KHighQuality; |
|
1222 switch(iAppUi.iNetworkController->IdentifyConnectionType()) |
|
1223 { |
|
1224 case EGprs: // Falls through. |
|
1225 case EEdge: |
|
1226 { |
|
1227 //if GPRS network get the selection |
|
1228 qualityrequired = iIRSettings.GetGPRSBitrateQuality(); |
|
1229 } |
|
1230 break; |
|
1231 case EWcdma: |
|
1232 case ECdma2000: |
|
1233 { |
|
1234 //if 3G network get the selection |
|
1235 qualityrequired = iIRSettings.Get3GBitrateQuality(); |
|
1236 } |
|
1237 break; |
|
1238 |
|
1239 case EWiFi: |
|
1240 { |
|
1241 //if WiFi network get the selection |
|
1242 qualityrequired = iIRSettings.GetWiFiBitrateQuality(); |
|
1243 } |
|
1244 break; |
|
1245 default: |
|
1246 { |
|
1247 //if WiFi network get the selection |
|
1248 qualityrequired = iIRSettings.GetWiFiBitrateQuality(); |
|
1249 } |
|
1250 break; |
|
1251 } |
|
1252 iQualityRequired=qualityrequired; |
|
1253 selectedbitrate = 0; |
|
1254 //depending on required quality we are selecting bit rate |
|
1255 selectedbitrate = GetAvailableBitRate(qualityrequired,aPreset); |
|
1256 |
|
1257 IRLOG_INFO3( "CIRNowPlayingWrapper::SelectUrlUsingBitRate - selectedbitrate=%d, qualityrequired=%d", |
|
1258 selectedbitrate, qualityrequired ); |
|
1259 |
|
1260 //getting all the available URLs |
|
1261 if(iURLArray) |
|
1262 { |
|
1263 delete iURLArray; |
|
1264 iURLArray = NULL; |
|
1265 } |
|
1266 TRAP_IGNORE(iURLArray = aPreset.GetUrlForBitrateL(selectedbitrate)) |
|
1267 #endif |
|
1268 |
|
1269 IRLOG_DEBUG( "CIRNowPlayingWrapper::SelectUrlUsingBitRate - Exiting." ); |
|
1270 return; |
|
1271 } |
|
1272 |
|
1273 /// --------------------------------------------------------------------------- |
|
1274 // CIRNowPlayingWrapper::DisplayErrorNoteL() |
|
1275 // Display the error note |
|
1276 // --------------------------------------------------------------------------- |
|
1277 // |
|
1278 void CIRNowPlayingWrapper::DisplayErrorNoteL(TInt aResourceId) |
|
1279 { |
|
1280 IRLOG_DEBUG( "CIRNowPlayingWrapper::DisplayErrorNoteL - Entering" ); |
|
1281 HBufC* error = StringLoader::LoadLC(aResourceId); |
|
1282 iIsdsWrapper.GetDialogLauncherInstance()->ShowErrorNoteL(aResourceId,ETrue); |
|
1283 CleanupStack::PopAndDestroy(error); |
|
1284 IRLOG_DEBUG( "CIRNowPlayingWrapper::DisplayErrorNoteL - Exiting" ); |
|
1285 } |
|
1286 // --------------------------------------------------------------------------- |
|
1287 // CIRNowPlayingWrapper::DoConnectToServerL() |
|
1288 // Connects to Server. |
|
1289 // --------------------------------------------------------------------------- |
|
1290 // |
|
1291 void CIRNowPlayingWrapper::DoConnectToServerL(const TDesC8& aUrl) |
|
1292 { |
|
1293 IRLOG_DEBUG( "CIRNowPlayingWrapper::DoConnectToServerL - Entering" ); |
|
1294 //Compress the heap memory |
|
1295 iListenFromIsds=ETrue; |
|
1296 RHeap& heapHandle = User::Heap(); |
|
1297 heapHandle.Compress();iListenFromIsds=ETrue; |
|
1298 //This variable is used for checking whether request for each URl is done |
|
1299 iConnectionRequestCancelled = EFalse; |
|
1300 TBuf<KTemporaryUrlMaxLength> temporaryUrl; |
|
1301 //This variable set while reconnecting to the same channel |
|
1302 iReConnecting = EFalse; |
|
1303 temporaryUrl.Copy(aUrl); |
|
1304 if( (iLastConnectedUrl.Compare(temporaryUrl) == 0) && |
|
1305 (iLastPlayedUrl.Compare(temporaryUrl) == 0) ) |
|
1306 { |
|
1307 TInt test=iNowPlayingPreset->UniqId(); |
|
1308 if( iNowPlayingPreset->UniqId() != iLastConnectedPresetUniqId && iPlaying) |
|
1309 { |
|
1310 //if channel's unique is not equal to last connected channels unique id but |
|
1311 //their urls match the preset information has to be updated |
|
1312 //and channel name has to be changed |
|
1313 iLastConnectedPresetId = iNowPlayingPreset->GetId(); |
|
1314 iLastConnectedPresetUniqId = iNowPlayingPreset->UniqId(); |
|
1315 iAppUi.GetNowPlayingViewInstance()->SetsameUrlFlag(ETrue); |
|
1316 PublishDataL(); |
|
1317 if(!iAppUi.GetNowPlayingViewInstance()->iContainer) |
|
1318 { |
|
1319 if ( iAppUi.IsForeground() || iAppUi.GetBgWhenLockState() ) |
|
1320 { |
|
1321 iAppUi.SetActivationPendingValue(KNullUid); |
|
1322 if(iContextViews==EHistoryView) |
|
1323 { |
|
1324 iAppUi.ActivateLocalViewL( KIRNowPlayingViewID, |
|
1325 KHistoryLaunch,KIRNowPlayingViewCustomMessagePlayAfterActivation); |
|
1326 } |
|
1327 else if(iContextViews==EFav) |
|
1328 { |
|
1329 _LIT8(KNull,""); |
|
1330 TRAP_IGNORE(iAppUi.ActivateLocalViewL( KIRNowPlayingViewID, |
|
1331 KNowPlayingFrmMainView,KNull);) |
|
1332 } |
|
1333 |
|
1334 else |
|
1335 { |
|
1336 TRAP_IGNORE(iAppUi.ActivateLocalViewL(KIRNowPlayingViewID)) |
|
1337 } |
|
1338 } |
|
1339 else |
|
1340 { |
|
1341 iAppUi.SetActivationPendingValue(KIRNowPlayingViewID); |
|
1342 } |
|
1343 } |
|
1344 } |
|
1345 //If radioplay back is occured and if the user Tries to connect |
|
1346 //to the same connected channel |
|
1347 else if(iPlayBack && iPlaying) |
|
1348 { |
|
1349 PublishDataL(); |
|
1350 if( KIRNowPlayingViewID == iAppUi.GetPresentViewID() ) |
|
1351 { |
|
1352 //redraw now playing view if already activated |
|
1353 iAppUi.GetNowPlayingViewInstance()->SetsameUrlFlag(ETrue); |
|
1354 } |
|
1355 else |
|
1356 { |
|
1357 //last played url is same as current url no need |
|
1358 //to reconnect loads the now playing view |
|
1359 if ( iAppUi.IsForeground() || iAppUi.GetBgWhenLockState() ) |
|
1360 { |
|
1361 //if in fore ground view is loaded |
|
1362 iAppUi.ActivateLocalViewL( KIRNowPlayingViewID, |
|
1363 KIRNowPlayingViewCustomMessageId, |
|
1364 KIRNowPlayingViewCustomMessagePlayAfterActivation ); |
|
1365 iAppUi.SetActivationPendingValue(KNullUid) ; |
|
1366 } |
|
1367 else |
|
1368 { |
|
1369 iAppUi.SetActivationPendingValue(KIRNowPlayingViewID) ; |
|
1370 } |
|
1371 } |
|
1372 } |
|
1373 else if((iURLArray->MdcaCount()==1)||(iUinqid==iNowPlayingPreset->UniqId())) |
|
1374 { |
|
1375 DoPlayL(); |
|
1376 } |
|
1377 |
|
1378 } |
|
1379 else |
|
1380 { |
|
1381 //If the next channel is getting connected then the Session which is made |
|
1382 //should get terminated |
|
1383 if(iPlaying) |
|
1384 { |
|
1385 //audio fade in has to be done |
|
1386 iAudioFadein = ETrue; |
|
1387 iPlaying=EFalse; |
|
1388 } |
|
1389 iTerminatedLogOnCancel=ETrue; |
|
1390 if( iSessionStart ) |
|
1391 { |
|
1392 /*if( !iSessionShouldNotEnd ) |
|
1393 { |
|
1394 //posting the previous session after ending it |
|
1395 TTerminationStatus terminationstatus = EUserTerminated; |
|
1396 //ending the previous session |
|
1397 iReportGenerator->UpdateTerminatedBy(terminationstatus); |
|
1398 iSessionStart = EFalse; |
|
1399 iSessionShouldNotEnd = EFalse; |
|
1400 //session end is called |
|
1401 TRAPD(error,iReportGenerator->SessionEndL(ETrue)); |
|
1402 if( error ) |
|
1403 { |
|
1404 IRLOG_ERROR2( "CIRNowPlayingWrapper::DoConnectToServerL - Report generation (Session End) failed (error=%d).", |
|
1405 error ); |
|
1406 } |
|
1407 }*/ |
|
1408 iSessionShouldNotEnd = EFalse; |
|
1409 } |
|
1410 if(!iSessionStart) |
|
1411 { |
|
1412 LogStartSession(); |
|
1413 } |
|
1414 iUrl.Copy(aUrl); |
|
1415 //connection to new server url is attempted |
|
1416 ConnectToServerL(); |
|
1417 } |
|
1418 IRLOG_DEBUG( "CIRNowPlayingWrapper::DoConnectToServerL - Exiting." ); |
|
1419 } |
|
1420 // --------------------------------------------------------------------------- |
|
1421 // CIRNowPlayingWrapper::GetAvailableBitRate() |
|
1422 // Selects proper bit rate from the settings |
|
1423 // it can be low quality (<48), medium quality (<128), high quality(>=128) |
|
1424 // nearest quality bitrate is selected if none is available the lowest one, |
|
1425 // which is the first one in preset array is returned |
|
1426 // --------------------------------------------------------------------------- |
|
1427 // |
|
1428 TInt CIRNowPlayingWrapper::GetAvailableBitRate(TInt aQualiyRequired, |
|
1429 const CIRIsdsPreset& aPreset) const |
|
1430 { |
|
1431 IRLOG_DEBUG2( "CIRNowPlayingWrapper::GetAvailableBitRate(aQualityRequired )", aQualiyRequired ); |
|
1432 TInt qualityrequired = aQualiyRequired; |
|
1433 |
|
1434 //checking the quality is between KLowQuality and KHighQuality |
|
1435 if( KLowQuality > qualityrequired ) |
|
1436 { |
|
1437 qualityrequired = KLowQuality; |
|
1438 } |
|
1439 if( KHighQuality < qualityrequired ) |
|
1440 { |
|
1441 qualityrequired = KHighQuality; |
|
1442 } |
|
1443 |
|
1444 //getting all available bit rates from preset |
|
1445 RArray<TInt> arrayofbitrates; |
|
1446 aPreset.GetAvailableBitrates(arrayofbitrates); |
|
1447 |
|
1448 //finding the number of bit rates available |
|
1449 TInt noofbitrateentries = arrayofbitrates.Count(); |
|
1450 TInt bitrate = 0; |
|
1451 //bit rate is not found |
|
1452 TBool bitratefound = EFalse; |
|
1453 //selecting the bitrate since index is one less than count we taken |
|
1454 //noofbitrateentries - 1 |
|
1455 while(((noofbitrateentries - 1) >= 0) && (EFalse == bitratefound)) |
|
1456 { |
|
1457 //proper bit rate is not found |
|
1458 bitratefound = EFalse; |
|
1459 //get the bit rate from the array for comparison |
|
1460 bitrate = arrayofbitrates[noofbitrateentries - 1]; |
|
1461 if( KLowQuality == qualityrequired ) |
|
1462 { |
|
1463 //if required quality is low we will select all the bit rate |
|
1464 // less than Medium quality level (<48kbps) |
|
1465 if( KMediumBitRateLimit > bitrate ) |
|
1466 { |
|
1467 bitratefound = ETrue; |
|
1468 } |
|
1469 } |
|
1470 else if( KMediumQuality == qualityrequired ) |
|
1471 { |
|
1472 //if required quality is medium we will select all the bit |
|
1473 //rate less than high quality level (<48kbps) |
|
1474 if( KHighBitRateLimit > bitrate ) |
|
1475 { |
|
1476 bitratefound = ETrue; |
|
1477 } |
|
1478 } |
|
1479 else |
|
1480 { |
|
1481 //if required quality is high we will allow current bit rate |
|
1482 bitratefound = ETrue; |
|
1483 } |
|
1484 //if we take next element if noofbitrateentries is greater than zero |
|
1485 //and bitratefound = EFalse |
|
1486 noofbitrateentries--; |
|
1487 } |
|
1488 //if no bitrate is available we will sent the first bitrate from entry |
|
1489 |
|
1490 arrayofbitrates.Close(); |
|
1491 IRLOG_DEBUG2( "CIRNowPlayingWrapper::GetAvailableBitRate - Returning %d", bitrate ); |
|
1492 return bitrate; |
|
1493 } |
|
1494 |
|
1495 |
|
1496 // --------------------------------------------------------------------------- |
|
1497 // CIRNowPlayingWrapper::LogStartSession() |
|
1498 // Starts the session log session. |
|
1499 // --------------------------------------------------------------------------- |
|
1500 // |
|
1501 void CIRNowPlayingWrapper::LogStartSession() |
|
1502 { |
|
1503 IRLOG_DEBUG( "CIRNowPlayingWrapper::LogStartSession - Entering" ); |
|
1504 iReportGenerator->UpdateConnectedFrom(iConnectedFrom); |
|
1505 //setting the channel id |
|
1506 SetCurrentChannelID(); |
|
1507 iReportGenerator->UpdateChannelID(iChannelID); |
|
1508 //update current operator |
|
1509 iReportGenerator->UpdateCurrentNetwork(iAppUi.GetCurrentOperatorValue()); |
|
1510 iReportGenerator->UpdateNmsCurrentNetwork(iAppUi.GetCurrentOperatorValue()); |
|
1511 //update home operator |
|
1512 iReportGenerator->UpdateHomeOperator(iAppUi.GetHomeOperatorValue()); |
|
1513 iReportGenerator->UpdateNmsHomeOperator(iAppUi.GetHomeOperatorValue()); |
|
1514 if(iSessionStartedFlag) |
|
1515 { |
|
1516 iSessionStart = ETrue; |
|
1517 } |
|
1518 else |
|
1519 { |
|
1520 //if session ended new session starts |
|
1521 TRAPD(error,iReportGenerator->SessionStartedL()); |
|
1522 if( error ) |
|
1523 { |
|
1524 iSessionStart = EFalse; |
|
1525 } |
|
1526 else |
|
1527 { |
|
1528 iSessionStart = ETrue; |
|
1529 } |
|
1530 } |
|
1531 IRLOG_DEBUG( "CIRNowPlayingWrapper::LogStartSession - Exiting" ); |
|
1532 } |
|
1533 |
|
1534 // --------------------------------------------------------------------------- |
|
1535 // Function : SetCurrentChannelID |
|
1536 // Function sets currently playing channel ID |
|
1537 // --------------------------------------------------------------------------- |
|
1538 // |
|
1539 void CIRNowPlayingWrapper::SetCurrentChannelID() |
|
1540 { |
|
1541 IRLOG_DEBUG( "CIRNowPlayingWrapper::SetCurrentChannelID - Entering" ); |
|
1542 //get current channel id |
|
1543 iChannelID = iNowPlayingPreset->GetId(); |
|
1544 IRLOG_INFO2( "CIRNowPlayingWrapper::SetCurrentChannelID - ID now %d", iChannelID ); |
|
1545 IRLOG_DEBUG( "CIRNowPlayingWrapper::SetCurrentChannelID - Exiting" ); |
|
1546 } |
|
1547 |
|
1548 // --------------------------------------------------------------------------- |
|
1549 // CIRNowPlayingWrapper::ConnectToServerL() |
|
1550 // Starts playing the selected stream |
|
1551 // --------------------------------------------------------------------------- |
|
1552 // |
|
1553 void CIRNowPlayingWrapper::ConnectToServerL() |
|
1554 { |
|
1555 //connection to a particular channel server url is |
|
1556 //attempted |
|
1557 IRLOG_DEBUG( "CIRNowPlayingWrapper::ConnectToServerL - Entering" ); |
|
1558 iChannelConnect = ETrue; |
|
1559 iConnectToServer=ETrue; |
|
1560 RProperty::Get ( KUidActiveInternetRadioApp, KIRPSBitrate, |
|
1561 iBitRateValue); |
|
1562 |
|
1563 // ASF streaming check |
|
1564 iAsfStreaming = EFalse; |
|
1565 #ifdef __IRA_FEATURE_WMA_ENABLED |
|
1566 if( CIRAsfPlayer::DetectAsfChannel(iUrl) ) |
|
1567 { |
|
1568 iAsfStreaming = ETrue; |
|
1569 iAsfPlayer->PlayL(iUrl); |
|
1570 } |
|
1571 #endif |
|
1572 if( !iAsfStreaming ) |
|
1573 { |
|
1574 iNetwork->ConnectToServerL(iUrl); |
|
1575 } |
|
1576 |
|
1577 iIsConnected = ETrue; |
|
1578 //iFromPlsFile = EFalse |
|
1579 IRLOG_DEBUG( "CIRNowPlayingWrapper::ConnectToServerL - Exiting." ); |
|
1580 } |
|
1581 |
|
1582 // --------------------------------------------------------------------------- |
|
1583 // Function : SetCurrentConnectionSource |
|
1584 // Function sets from where the current connection to the channel server |
|
1585 // is established. It may be from |
|
1586 // isds or saved preset |
|
1587 // --------------------------------------------------------------------------- |
|
1588 // |
|
1589 void CIRNowPlayingWrapper::SetCurrentConnectionSource(TConnectedFrom aConnectedFrom) |
|
1590 { |
|
1591 //0 means isds |
|
1592 //1 means saved preset |
|
1593 IRLOG_DEBUG2( "CIRNowPlayingWrapper::SetCurrentConnectionSource(aConnectedFrom=%d)", aConnectedFrom ); |
|
1594 iConnectedFrom = aConnectedFrom; |
|
1595 IRLOG_DEBUG( "CIRNowPlayingWrapper::SetCurrentConnectionSource - Exiting" ); |
|
1596 } |
|
1597 // --------------------------------------------------------------------------- |
|
1598 // CIRNowPlayingWrapper::DoErrorConnectingL() |
|
1599 // Called by CIRStreamSource when there is an error in connectiong |
|
1600 // --------------------------------------------------------------------------- |
|
1601 // |
|
1602 void CIRNowPlayingWrapper::DoErrorConnectingL(TInt aErrorCode) |
|
1603 { |
|
1604 IRLOG_ERROR3("CIRNowPlayingWrapper::DoErrorConnectingL(aErrorCode=%d) - iUrl=%S", aErrorCode, &iUrl ); |
|
1605 //Called by CIRStreamSource when there is an error in connectiong |
|
1606 //to channel server. |
|
1607 iChannelConnected=EFalse; |
|
1608 if(iSessionStart) |
|
1609 { |
|
1610 if( KIRStreamSourceTimeOut == aErrorCode ) |
|
1611 { |
|
1612 //error URLs is logged |
|
1613 iReportGenerator->LogServerResult(iUrl,EIRConnTimeOut); |
|
1614 } |
|
1615 else if( KIRStreamSourceNoResponse == aErrorCode ) |
|
1616 { |
|
1617 //error URLs is logged |
|
1618 iReportGenerator->LogServerResult(iUrl,EIRFull); |
|
1619 } |
|
1620 else |
|
1621 { |
|
1622 //error URLs is logged |
|
1623 iReportGenerator->LogServerResult(iUrl,EIRConnFailed); |
|
1624 } |
|
1625 } |
|
1626 |
|
1627 //URL is deleted |
|
1628 iUrl.Zero(); |
|
1629 iURLCount++; |
|
1630 //since each preset has multiple urls trying to connect to the next url |
|
1631 if( iMultipleURLSelect ) |
|
1632 { |
|
1633 //if error before connection to channel server |
|
1634 //multiple urlselection is enabled |
|
1635 if( (iURLCount) < iURLArray->MdcaCount() && !iConnectionRequestCancelled ) |
|
1636 { |
|
1637 //take the subsequent URLs and play in case of failure |
|
1638 TBuf8<KUrlbufMaxLength> urlbuf; |
|
1639 urlbuf.Copy(iURLArray->MdcaPoint(iURLCount)); |
|
1640 iUnconnectedUrl.Copy(urlbuf); |
|
1641 iMultipleURLSelect = ETrue; |
|
1642 iSessionShouldNotEnd = ETrue; |
|
1643 //connect to server is called |
|
1644 DoConnectToServerL(urlbuf); |
|
1645 } |
|
1646 else |
|
1647 { |
|
1648 //If all the possible urls fails to connect it displays |
|
1649 //Unable to connect |
|
1650 iTerminatedLogOnCancel=EFalse; |
|
1651 if(iAppUi.GetNowPlayingViewInstance()->iContainer) |
|
1652 { |
|
1653 iDisplayMetaData=ETrue; |
|
1654 iAppUi.GetNowPlayingViewInstance()->DisplaySongArtistNameL( KConst,KConst); |
|
1655 iLastPlayedUrl.Copy(iUnconnectedUrl); |
|
1656 iLastConnectedUrl.Copy(iUnconnectedUrl); |
|
1657 iLastConnectedPresetId=0; |
|
1658 } |
|
1659 else |
|
1660 { |
|
1661 iUrl.Delete(0,iUrl.Length()); |
|
1662 iLastConnectedUrl.Zero(); |
|
1663 iLastPlayedUrl.Zero(); |
|
1664 } |
|
1665 ClearMetaDataL(); |
|
1666 DestroyWaitDialogL(); |
|
1667 iPlayBack=ETrue; |
|
1668 if((iAppUi.GetNowPlayingViewInstance()->iContainer)) |
|
1669 { |
|
1670 iAppUi.GetNowPlayingViewInstance()->SetBitrate(ETrue); |
|
1671 } |
|
1672 iDialogCanceled=EFalse; |
|
1673 iConnectToServer=EFalse; |
|
1674 iNotify=EFalse; |
|
1675 iListenFromIsds=EFalse; |
|
1676 if(iAppUi.ActiveView() == KIRMainChoiceViewID) |
|
1677 { |
|
1678 iAppUi.iMainView->GetMainContainer()->UpdateAllL(); |
|
1679 } |
|
1680 iAppUi.SetPlayStateWhileCall(EFalse); |
|
1681 iAppUi.GetPubSubManagerInstance()->PublishBufferingState(EIRStateBufferingError); |
|
1682 DisplayErrorNoteL(aErrorCode == |
|
1683 KIRStreamSourceInvalidUrl ? R_IRAPP_ERROR_ADDRESS : R_IRAPP_ERROR_GENERAL); |
|
1684 iConnErrCode = 0; |
|
1685 //Since channel is not able to connect Ending the Session |
|
1686 if(iSessionStart) |
|
1687 { |
|
1688 //update current operator |
|
1689 iReportGenerator->UpdateCurrentNetwork(iAppUi.GetCurrentOperatorValue()); |
|
1690 iReportGenerator->UpdateNmsCurrentNetwork(iAppUi.GetCurrentOperatorValue()); |
|
1691 //update home operator |
|
1692 iReportGenerator->UpdateHomeOperator(iAppUi.GetHomeOperatorValue()); |
|
1693 iReportGenerator->UpdateNmsHomeOperator(iAppUi.GetHomeOperatorValue()); |
|
1694 |
|
1695 TTerminationStatus terminationstatus = ENoConnectionToServer; |
|
1696 //and the cause of error |
|
1697 iReportGenerator->UpdateTerminatedBy(terminationstatus); |
|
1698 //session ends due to error |
|
1699 iReportGenerator->SessionEndL(EFalse); |
|
1700 iSessionStart=EFalse; |
|
1701 iSessionShouldNotEnd = EFalse;//check |
|
1702 } |
|
1703 DoPlayingStateChanged( EFalse ); |
|
1704 } |
|
1705 } |
|
1706 else |
|
1707 { |
|
1708 //if the error is Connection Timed out |
|
1709 if( KIRStreamSourceTimeOut == aErrorCode ) |
|
1710 { |
|
1711 //if the response is no response from server |
|
1712 if( iProgress ) |
|
1713 { |
|
1714 //progress bar view is cancelled |
|
1715 ProgressBarCancel(); |
|
1716 } |
|
1717 DestroyWaitDialogL(); |
|
1718 iConnectToServer=EFalse; |
|
1719 iNotify=EFalse; |
|
1720 iListenFromIsds=EFalse; |
|
1721 iDialogCanceled=EFalse; |
|
1722 |
|
1723 iAppUi.GetPubSubManagerInstance()->PublishBufferingState(EIRStateBufferingError); |
|
1724 |
|
1725 //error note to be displayed |
|
1726 DisplayErrorNoteL(R_IRAPP_ERROR_CONNECTION);//player is expected not to play |
|
1727 ClearMetaDataL(); |
|
1728 iLastPlayedUrl.Copy(iUnconnectedUrl); |
|
1729 iLastConnectedUrl.Copy(iUnconnectedUrl); |
|
1730 iLastConnectedPresetId=0; |
|
1731 iPlayBack=ETrue; |
|
1732 DoPlayingStateChanged( EFalse ); |
|
1733 iAppUi.SetPlayStateWhileCall(EFalse); |
|
1734 } |
|
1735 else |
|
1736 { |
|
1737 StopNow(); |
|
1738 //if error due connection at any point after connecting to channel server |
|
1739 if(iAppUi.GetNowPlayingViewInstance()->iContainer) |
|
1740 { |
|
1741 iDisplayMetaData=ETrue; |
|
1742 iAppUi.GetNowPlayingViewInstance()->DisplaySongArtistNameL( KConst,KConst); |
|
1743 iLastPlayedUrl.Copy(iUnconnectedUrl); |
|
1744 iLastConnectedUrl.Copy(iUnconnectedUrl); |
|
1745 iLastConnectedPresetId=0; |
|
1746 } |
|
1747 else |
|
1748 { |
|
1749 iUrl.Delete(0,iUrl.Length()); |
|
1750 iLastConnectedUrl.Zero(); |
|
1751 iLastPlayedUrl.Zero(); |
|
1752 } |
|
1753 ClearMetaDataL(); |
|
1754 iTerminatedLogOnCancel=EFalse; |
|
1755 iDialogCanceled=EFalse; |
|
1756 DestroyWaitDialogL(); |
|
1757 DoPlayingStateChanged(EFalse); |
|
1758 if((iAppUi.GetNowPlayingViewInstance()->iContainer)) |
|
1759 { |
|
1760 iAppUi.GetNowPlayingViewInstance()->SetBitrate(ETrue); |
|
1761 } |
|
1762 iConnectToServer=EFalse; |
|
1763 iNotify=EFalse; |
|
1764 iListenFromIsds=EFalse; |
|
1765 iPlayBack=ETrue; |
|
1766 if(iAppUi.ActiveView() == KIRMainChoiceViewID) |
|
1767 { |
|
1768 iAppUi.iMainView->GetMainContainer()->UpdateAllL(); |
|
1769 } |
|
1770 |
|
1771 iAppUi.GetPubSubManagerInstance()->PublishBufferingState(EIRStateBufferingError); |
|
1772 |
|
1773 if(!iAppUi.iNetworkController->IsHandingOverConnection()) |
|
1774 { |
|
1775 |
|
1776 if (aErrorCode != KIRStreamSourceDisconnected) |
|
1777 { |
|
1778 DisplayErrorNoteL(aErrorCode == KIRStreamSourceInvalidUrl ? |
|
1779 R_IRAPP_ERROR_ADDRESS : R_IRAPP_ERROR_GENERAL); |
|
1780 } |
|
1781 } |
|
1782 } |
|
1783 if(iSessionStart) |
|
1784 { |
|
1785 //update current operator |
|
1786 iReportGenerator->UpdateCurrentNetwork(iAppUi.GetCurrentOperatorValue()); |
|
1787 iReportGenerator->UpdateNmsCurrentNetwork(iAppUi.GetCurrentOperatorValue()); |
|
1788 //update home operator |
|
1789 iReportGenerator->UpdateHomeOperator(iAppUi.GetHomeOperatorValue()); |
|
1790 iReportGenerator->UpdateNmsHomeOperator(iAppUi.GetHomeOperatorValue()); |
|
1791 |
|
1792 TTerminationStatus terminationstatus = ENoConnectionToServer; |
|
1793 //and the cause of error |
|
1794 iReportGenerator->UpdateTerminatedBy(terminationstatus); |
|
1795 //session ends due to error |
|
1796 iReportGenerator->SessionEndL(EFalse); |
|
1797 iSessionStart=EFalse; |
|
1798 iSessionShouldNotEnd = EFalse;//check |
|
1799 } |
|
1800 } |
|
1801 IRLOG_DEBUG( "CIRNowPlayingWrapper::DoErrorConnectingL - Exiting."); |
|
1802 } |
|
1803 |
|
1804 // --------------------------------------------------------------------------- |
|
1805 // CIRNowPlayingWrapper::ProgressBarCancel() |
|
1806 // Cancels the Network request and stops the buffering on progressbar cancel. |
|
1807 // --------------------------------------------------------------------------- |
|
1808 // |
|
1809 void CIRNowPlayingWrapper::ProgressBarCancel() |
|
1810 { |
|
1811 IRLOG_DEBUG( "CIRNowPlayingWrapper::ProgressBarCancel - Entering"); |
|
1812 |
|
1813 RProperty::Set( KUidActiveInternetRadioApp, |
|
1814 KIRPSBitrate, iBitRateValue ); |
|
1815 //Cancel the Network request |
|
1816 |
|
1817 /**** ASF streaming changes : begin ****/ |
|
1818 //Cancel the Network request |
|
1819 if(!iAsfStreaming) |
|
1820 iNetwork->CancelRequest(); |
|
1821 /**** ASF streaming changes : end ****/ |
|
1822 |
|
1823 iLastConnectedPresetId=0; |
|
1824 iLastConnectedPresetUniqId = 0; |
|
1825 DoPlayingStateChanged( EFalse ); |
|
1826 iAudioFadein = EFalse; |
|
1827 iProgress = EFalse; |
|
1828 if(iAppUi.GetNowPlayingViewInstance()->iContainer) |
|
1829 { |
|
1830 iLastPlayedUrl.Copy(iUnconnectedUrl); |
|
1831 iLastConnectedUrl.Copy(iUnconnectedUrl); |
|
1832 } |
|
1833 else |
|
1834 { |
|
1835 iUrl.Delete(0,iUrl.Length()); |
|
1836 iLastConnectedUrl.Zero(); |
|
1837 iLastPlayedUrl.Zero(); |
|
1838 } |
|
1839 //stops buffering from media client, media engine is not stopped |
|
1840 |
|
1841 //stops buffering from media client, media engine is not stopped |
|
1842 /**** ASF streaming changes : begin ****/ |
|
1843 if(!iAsfStreaming) |
|
1844 iPlayer->StopInitialBuffering(); |
|
1845 /**** ASF streaming changes : end ****/ |
|
1846 |
|
1847 if(!iCancelNetworkRequest) |
|
1848 { |
|
1849 if( iSessionStart ) |
|
1850 { |
|
1851 //update current operator |
|
1852 iReportGenerator->UpdateCurrentNetwork(iAppUi.GetCurrentOperatorValue()); |
|
1853 iReportGenerator->UpdateNmsCurrentNetwork(iAppUi.GetCurrentOperatorValue()); |
|
1854 //update home operator |
|
1855 iReportGenerator->UpdateHomeOperator(iAppUi.GetHomeOperatorValue()); |
|
1856 iReportGenerator->UpdateNmsHomeOperator(iAppUi.GetHomeOperatorValue()); |
|
1857 |
|
1858 TTerminationStatus terminationstatus = EUserTerminated; |
|
1859 //ending the previous session |
|
1860 iReportGenerator->UpdateTerminatedBy(terminationstatus); |
|
1861 iSessionStart = EFalse; |
|
1862 iSessionShouldNotEnd = EFalse; |
|
1863 //session is ended |
|
1864 TRAP_IGNORE( iReportGenerator->SessionEndL(EFalse) ) |
|
1865 } |
|
1866 } |
|
1867 iCancelNetworkRequest=EFalse; |
|
1868 IRLOG_DEBUG( "CIRNowPlayingWrapper::ProgressBarCancel - Exiting." ); |
|
1869 } |
|
1870 // --------------------------------------------------------------------------- |
|
1871 // CIRNowPlayingWrapper::DoPlayingStateChangedL() |
|
1872 // Handles internal state change and P&S when playing is stopped or started. |
|
1873 // --------------------------------------------------------------------------- |
|
1874 // |
|
1875 void CIRNowPlayingWrapper::DoPlayingStateChanged( TBool aPlaying ) |
|
1876 { |
|
1877 IRLOG_INFO2( "CIRNowPlayingWrapper::DoPlayingStateChanged - playing state=%d", aPlaying ); |
|
1878 if ( aPlaying ) |
|
1879 { |
|
1880 iPlaying = ETrue; |
|
1881 iAppUi.GetNowPlayingViewInstance()->SetPlayingValue (iPlaying); |
|
1882 iAppUi.GetPubSubManagerInstance()->PublishChannel( iNowPlayingPreset->GetName() ); |
|
1883 iAppUi.GetPubSubManagerInstance()->PublishPlayStop( EIRStatePlay ); |
|
1884 } |
|
1885 else |
|
1886 { |
|
1887 iPlaying = EFalse; |
|
1888 iAppUi.GetNowPlayingViewInstance()->SetPlayingValue (iPlaying); |
|
1889 iAppUi.GetPubSubManagerInstance()->PublishPlayStop( EIRStateStop ); |
|
1890 } |
|
1891 if(iAppUi.GetNowPlayingViewInstance()->iContainer) |
|
1892 { |
|
1893 TRAP_IGNORE(iAppUi.GetNowPlayingViewInstance()->ConstructToolbarL();) |
|
1894 } |
|
1895 IRLOG_DEBUG( "CIRNowPlayingWrapper::DoPlayingStateChangedL - Exiting" ); |
|
1896 } |
|
1897 // --------------------------------------------------------------------------- |
|
1898 // CIRNowPlayingWrapper::DoPlay() |
|
1899 // First try to reconnect to the last played channel url |
|
1900 // --------------------------------------------------------------------------- |
|
1901 // |
|
1902 void CIRNowPlayingWrapper::DoPlayL() |
|
1903 { |
|
1904 IRLOG_INFO( "CIRNowPlayingWrapper::DoPlayL - Entering" ); |
|
1905 CreateWaitDialogL(); |
|
1906 iAppUi.GetPubSubManagerInstance()->PublishBufferingState(EIRStateBufferingStart); |
|
1907 |
|
1908 //reconnecting to the channel |
|
1909 if( iAppUi.GetCallConnectedState() ) |
|
1910 { |
|
1911 IRLOG_DEBUG( "CIRNowPlayingWrapper::DoPlayL - Call ongoing, Exiting." ); |
|
1912 return; |
|
1913 } |
|
1914 // connection exits hence proceed with the connection |
|
1915 // to channel |
|
1916 else |
|
1917 { |
|
1918 //load the loading screen |
|
1919 iMultipleURLSelect = EFalse; |
|
1920 iReConnecting = ETrue; |
|
1921 iChannelConnect = ETrue; |
|
1922 iDialogCanceled=EFalse; |
|
1923 iUrl.Copy(iLastPlayedUrl); |
|
1924 if((iAppUi.GetNowPlayingViewInstance()->iContainer)) |
|
1925 { |
|
1926 iLaunchNowplaying=ETrue; |
|
1927 } |
|
1928 /**** ASF streaming changes : begin ****/ |
|
1929 TInt error = KErrNone; |
|
1930 if(!iAsfStreaming) |
|
1931 { |
|
1932 TRAP(error,iNetwork->ReconnectL(iLastPlayedUrl)); |
|
1933 } |
|
1934 else |
|
1935 { |
|
1936 iAsfPlayer->PlayL(iLastPlayedUrl); |
|
1937 } |
|
1938 /**** ASF streaming changes : end ****/ |
|
1939 |
|
1940 if( error ) |
|
1941 { |
|
1942 IRLOG_ERROR2( "CIRNowPlayingWrapper::DoPlayL - Reconnect failed (error=%d)", error ); |
|
1943 TRAP_IGNORE(DisplayErrorNoteL(R_IRAPP_ERROR_CONNECTION)) |
|
1944 DestroyWaitDialogL(); |
|
1945 } |
|
1946 if(!iSessionStart) |
|
1947 { |
|
1948 LogStartSession(); |
|
1949 } |
|
1950 |
|
1951 } |
|
1952 IRLOG_DEBUG( "CIRNowPlayingWrapper::DoPlayL - Exiting." ); |
|
1953 |
|
1954 } |
|
1955 // --------------------------------------------------------------------------- |
|
1956 // CIRNowPlayingWrapper::StopNow() |
|
1957 // Function calls stop functionality. |
|
1958 // --------------------------------------------------------------------------- |
|
1959 // |
|
1960 void CIRNowPlayingWrapper::StopNow() |
|
1961 { |
|
1962 IRLOG_INFO( "CIRNowPlayingWrapper::StopNow - Entering" ); |
|
1963 if(iIsConnected) |
|
1964 { |
|
1965 //player is stopped |
|
1966 if(iPlaying) |
|
1967 { |
|
1968 |
|
1969 /**** ASF streaming changes : begin ****/ |
|
1970 if(!iAsfStreaming) |
|
1971 { |
|
1972 iPlayer->Stop(); |
|
1973 } |
|
1974 else |
|
1975 |
|
1976 { |
|
1977 iAsfPlayer->Stop(); |
|
1978 iAsfStreaming = EFalse; |
|
1979 } |
|
1980 /**** ASF streaming changes : end ****/ |
|
1981 |
|
1982 DoPlayingStateChanged( EFalse ); |
|
1983 if(iAppUi.ActiveView() == KIRMainChoiceViewID) |
|
1984 { |
|
1985 TRAP_IGNORE(iAppUi.iMainView->GetMainContainer()->UpdateAllL();) |
|
1986 } |
|
1987 iPlayandStop=EFalse; |
|
1988 if(iAppUi.GetNowPlayingViewInstance()->iContainer) |
|
1989 { |
|
1990 iPlayandStop=ETrue; |
|
1991 } |
|
1992 } |
|
1993 } |
|
1994 IRLOG_DEBUG( "CIRNowPlayingWrapper::StopNow - Exiting." ); |
|
1995 } |
|
1996 // --------------------------------------------------------------------------- |
|
1997 // CIRNowPlayingWrapper::ClearMetaDataL() |
|
1998 // Clears the current meta data information. |
|
1999 // --------------------------------------------------------------------------- |
|
2000 // |
|
2001 void CIRNowPlayingWrapper::ClearMetaDataL() |
|
2002 { |
|
2003 IRLOG_DEBUG( "CIRNowPlayingWrapper::ClearMetaDataL - Entering" ); |
|
2004 CIRMetaData* metaData = CIRMetaData::NewL(); |
|
2005 CleanupStack::PushL( metaData ); |
|
2006 // Handles clearing the information with strings read from resources |
|
2007 HandleMetaDataReceivedL( *metaData ); |
|
2008 CleanupStack::PopAndDestroy( metaData ); |
|
2009 IRLOG_DEBUG( "CIRNowPlayingWrapper::ClearMetaDataL - Exiting" ); |
|
2010 } |
|
2011 |
|
2012 // --------------------------------------------------------------------------- |
|
2013 // CIRNowPlayingWrapper::ListenToChannel() |
|
2014 // Requests for listening to a particular channel |
|
2015 // --------------------------------------------------------------------------- |
|
2016 // |
|
2017 void CIRNowPlayingWrapper::ListenToChannelL(CIRIsdsPreset* aPreset) |
|
2018 { |
|
2019 IRLOG_DEBUG( "CIRNowPlayingWrapper::ListenToChannel - Entering" ); |
|
2020 *iNowPlayingPreset = *aPreset; |
|
2021 |
|
2022 //replace the preset with favorites preset (if exists in favorites) |
|
2023 iAppUi.GetFavPresetsInstance()->ReplacePresetL(*iNowPlayingPreset); |
|
2024 |
|
2025 //channel is connected from isds |
|
2026 SetCurrentConnectionSource(EIRIsds); |
|
2027 //connecting to a particular channel |
|
2028 ConnectToChannelL(*iNowPlayingPreset); |
|
2029 IRLOG_DEBUG( "CIRNowPlayingWrapper::ListenToChannel - Exiting" ); |
|
2030 } |
|
2031 // --------------------------------------------------------------------------- |
|
2032 // CIRNowPlayingWrapper::MetaData() |
|
2033 // Returns the current meta data information. |
|
2034 // --------------------------------------------------------------------------- |
|
2035 // |
|
2036 const CIRMetaData& CIRNowPlayingWrapper::MetaData() const |
|
2037 { |
|
2038 IRLOG_DEBUG( "CIRNowPlayingWrapper::MetaData " ); |
|
2039 return *iMetaData; |
|
2040 } |
|
2041 |
|
2042 // ----------------------------------------------------------------------------- |
|
2043 // CIRNowPlayingWrapper::DialogDismissedL() |
|
2044 // Called by CAknwaitdialog |
|
2045 // ----------------------------------------------------------------------------- |
|
2046 // |
|
2047 void CIRNowPlayingWrapper::DialogDismissedL( TInt aButtonId ) |
|
2048 { |
|
2049 IRLOG_DEBUG( "CIRSearchView::DialogDismissedL() started." ); |
|
2050 |
|
2051 if(aButtonId == EIRCancel) |
|
2052 { |
|
2053 if(iSyncPreset) |
|
2054 { |
|
2055 iAppUi.iIsdsWrapper->GetISDSInstance()->IRISDSCancelRequest(); |
|
2056 iSyncPreset=EFalse; |
|
2057 if((iAppUi.iNowPlayingView->iContainer)) |
|
2058 { |
|
2059 iAppUi.iNowPlayingView->SetRockerIndex( |
|
2060 iAppUi.iNowPlayingView->GetPreviousIndex()); |
|
2061 } |
|
2062 iWaitDialog= NULL; |
|
2063 return; |
|
2064 } |
|
2065 if(!iDialogCanceled) |
|
2066 { |
|
2067 if(iContextViews==ESearch||iContextViews==EBrowseByTopStations |
|
2068 ||iContextViews==EStations||iContextViews==EHistoryView) |
|
2069 { |
|
2070 iAppUi.iIsdsWrapper->SetListenRequest(EFalse); |
|
2071 if(iNowPlayingPreset->GetChannelType()) |
|
2072 { |
|
2073 if(!iListenFromIsds) |
|
2074 { |
|
2075 if ( iAppUi.iIsdsWrapper->GetISDSInstance() ) |
|
2076 { |
|
2077 //iListenFromIsds=EFalse |
|
2078 iCancelFrmIsds=ETrue; |
|
2079 iAppUi.iIsdsWrapper->GetISDSInstance()->IRISDSCancelRequest(); |
|
2080 } |
|
2081 if((iAppUi.iNowPlayingView->iContainer)) |
|
2082 { |
|
2083 iAppUi.iIsdsWrapper->SetCurrentPlayingIndex( |
|
2084 iAppUi.iNowPlayingView->GetPreviousIndex()); |
|
2085 iAppUi.iNowPlayingView->SetRockerIndex( |
|
2086 iAppUi.iNowPlayingView->GetPreviousIndex()); |
|
2087 } |
|
2088 iWaitDialog= NULL; |
|
2089 return; |
|
2090 } |
|
2091 |
|
2092 } |
|
2093 } |
|
2094 if(iBufferigSteamText) |
|
2095 { |
|
2096 // Dialog will delete itself |
|
2097 iWaitDialog= NULL; |
|
2098 ProgressBarCancel(); |
|
2099 iUrl.Delete(0,iUrl.Length()); |
|
2100 iLastConnectedUrl.Zero(); |
|
2101 iLastPlayedUrl.Zero(); |
|
2102 iUinqid=0; |
|
2103 } |
|
2104 else |
|
2105 { |
|
2106 // Dialog will delete itself |
|
2107 iWaitDialog= NULL; |
|
2108 if(!(iAppUi.GetNowPlayingViewInstance()->GetsameUrlFlag())) |
|
2109 |
|
2110 CancelNetworkRequestL(); |
|
2111 DoPlayingStateChanged(EFalse); |
|
2112 iAppUi.GetNowPlayingViewInstance()->SetsameUrlFlag(EFalse); |
|
2113 iUrl.Delete(0,iUrl.Length()); |
|
2114 iLastConnectedUrl.Zero(); |
|
2115 iLastPlayedUrl.Zero(); |
|
2116 iUinqid=0; |
|
2117 } |
|
2118 ClearMetaDataL(); |
|
2119 if( iSessionStart ) |
|
2120 { |
|
2121 //update current operator |
|
2122 iReportGenerator->UpdateCurrentNetwork(iAppUi.GetCurrentOperatorValue()); |
|
2123 iReportGenerator->UpdateNmsCurrentNetwork(iAppUi.GetCurrentOperatorValue()); |
|
2124 //update home operator |
|
2125 iReportGenerator->UpdateHomeOperator(iAppUi.GetHomeOperatorValue()); |
|
2126 iReportGenerator->UpdateNmsHomeOperator(iAppUi.GetHomeOperatorValue()); |
|
2127 |
|
2128 TTerminationStatus terminationstatus = EUserTerminated; |
|
2129 //ending the previous session |
|
2130 iReportGenerator->UpdateTerminatedBy(terminationstatus); |
|
2131 iSessionStart = EFalse; |
|
2132 iSessionShouldNotEnd = EFalse; |
|
2133 //session is ended |
|
2134 TRAP_IGNORE( iReportGenerator->SessionEndL(EFalse) ) |
|
2135 } |
|
2136 } |
|
2137 } |
|
2138 |
|
2139 IRLOG_DEBUG( "CIRSearchView::DialogDismissedL() exiting." ); |
|
2140 } |
|
2141 |
|
2142 // --------------------------------------------------------------------------- |
|
2143 // Function : HandlePlayError() |
|
2144 // Handles play error || should called only through MCtrlCommand |
|
2145 // --------------------------------------------------------------------------- |
|
2146 // |
|
2147 void CIRNowPlayingWrapper::HandlePlayError() |
|
2148 { |
|
2149 IRLOG_ERROR( "CIRNowPlayingWrapper::HandlePlayError - Entering" ); |
|
2150 //if progress bar is present cancel progress bar |
|
2151 if( iProgress ) |
|
2152 { |
|
2153 ProgressBarCancel(); |
|
2154 TRAP_IGNORE(DestroyWaitDialogL()); |
|
2155 } |
|
2156 //buffering overlay if present is removed |
|
2157 |
|
2158 IRLOG_DEBUG( "CIRNowPlayingWrapper::HandlePlayError - Exiting." ); |
|
2159 } |
|
2160 |
|
2161 // --------------------------------------------------------------------------- |
|
2162 // CIRNowPlayingWrapper::PlayAndStopL() |
|
2163 // Performs play and stop functionality |
|
2164 // --------------------------------------------------------------------------- |
|
2165 // |
|
2166 void CIRNowPlayingWrapper::PlayAndStopL() |
|
2167 { |
|
2168 IRLOG_INFO( "CIRNowPlayingWrapper::PlayAndStopL - Entering" ); |
|
2169 |
|
2170 if( !iPlaying ) |
|
2171 { |
|
2172 //if currently status is not playing |
|
2173 //play request is issued |
|
2174 DoPlayL(); |
|
2175 |
|
2176 // Active Idle |
|
2177 TInt passId=iAppUi.GetFavPresetsInstance()->SearchPreset( iNowPlayingPreset->GetId(), |
|
2178 iNowPlayingPreset->UniqId()); |
|
2179 // Checks for the preset index of the channel, if preset index exists |
|
2180 // in favourites list, publishes the preset index. |
|
2181 if( passId != KErrNotFound) |
|
2182 { |
|
2183 TInt presetIndex = passId+1; |
|
2184 RProperty::Set( KUidActiveInternetRadioApp, KIRPSPresetIndex, |
|
2185 presetIndex ); |
|
2186 } |
|
2187 else |
|
2188 { |
|
2189 // If preset not present in favourites list, publishes the index |
|
2190 // as 0. This is set to 0 here to indicate the active idle |
|
2191 // component that the index with 0 is a non favourite channel. |
|
2192 TInt presetIndex = 0; |
|
2193 RProperty::Set( KUidActiveInternetRadioApp, KIRPSPresetIndex, |
|
2194 presetIndex ); |
|
2195 } |
|
2196 } |
|
2197 else |
|
2198 { |
|
2199 //if status is playing stop is called |
|
2200 if(iIsConnected) |
|
2201 { |
|
2202 iPlayandStop=ETrue; |
|
2203 iConnectToServer=EFalse; |
|
2204 /**** ASF streaming changes : begin ****/ |
|
2205 if(!iAsfStreaming) |
|
2206 iPlayer->Stop(); |
|
2207 /**** ASF streaming changes : end ****/ |
|
2208 |
|
2209 if( iSessionStart ) |
|
2210 { |
|
2211 //update current operator |
|
2212 iReportGenerator->UpdateCurrentNetwork(iAppUi.GetCurrentOperatorValue()); |
|
2213 iReportGenerator->UpdateNmsCurrentNetwork(iAppUi.GetCurrentOperatorValue()); |
|
2214 //update home operator |
|
2215 iReportGenerator->UpdateHomeOperator(iAppUi.GetHomeOperatorValue()); |
|
2216 iReportGenerator->UpdateNmsHomeOperator(iAppUi.GetHomeOperatorValue()); |
|
2217 |
|
2218 // End the session |
|
2219 iReportGenerator->UpdateTerminatedBy( EUserTerminated ); |
|
2220 iSessionStart = EFalse; |
|
2221 iSessionShouldNotEnd = EFalse; |
|
2222 iReportGenerator->SessionEndL( EFalse ); |
|
2223 } |
|
2224 DoPlayingStateChanged( EFalse ); |
|
2225 } |
|
2226 // Active Idle |
|
2227 TInt passId=iAppUi.GetFavPresetsInstance()->SearchPreset( iNowPlayingPreset->GetId(), |
|
2228 iNowPlayingPreset->UniqId()); |
|
2229 // Checks for the preset index of the channel, if preset index exists |
|
2230 // in favourites list, publishes the preset index. |
|
2231 if( passId != KErrNotFound) |
|
2232 { |
|
2233 TInt presetId = passId+1; |
|
2234 RProperty::Set( KUidActiveInternetRadioApp, KIRPSPresetIndex, |
|
2235 presetId ); |
|
2236 } |
|
2237 else |
|
2238 { |
|
2239 // If preset not present in favourites list, publishes the index |
|
2240 // as 0. This is set to 0 here to indicate the active idle |
|
2241 // component that the index with 0 is a non favourite channel. |
|
2242 TInt presetId = 0; |
|
2243 RProperty::Set( KUidActiveInternetRadioApp, KIRPSPresetIndex, |
|
2244 presetId ); |
|
2245 } |
|
2246 } |
|
2247 |
|
2248 IRLOG_DEBUG( "CIRNowPlayingWrapper::PlayAndStopL - Exiting." ); |
|
2249 } |
|
2250 |
|
2251 // --------------------------------------------------------------------------- |
|
2252 // LoadTerminateSession() |
|
2253 // The loading cancel result in session log end |
|
2254 // --------------------------------------------------------------------------- |
|
2255 // |
|
2256 void CIRNowPlayingWrapper::LoadTerminateSessionL() |
|
2257 { |
|
2258 IRLOG_DEBUG( "CIRNowPlayingWrapper::LoadTerminateSession - Entering." ); |
|
2259 //checks whether session log can be terminated |
|
2260 if( iTerminatedLogOnCancel ) |
|
2261 { |
|
2262 //loading cancel is cancelling session log |
|
2263 //session log should not be cancelled |
|
2264 iTerminatedLogOnCancel = EFalse; |
|
2265 //checks whether session log exists or not |
|
2266 if(iSessionStart) |
|
2267 { |
|
2268 //logging server results connection is not yet made |
|
2269 //and attempt is failed |
|
2270 iReportGenerator->LogServerResult(iUrl,EIRConnFailed); |
|
2271 //update current operator |
|
2272 iReportGenerator->UpdateCurrentNetwork(iAppUi.GetCurrentOperatorValue()); |
|
2273 iReportGenerator->UpdateNmsCurrentNetwork(iAppUi.GetCurrentOperatorValue()); |
|
2274 //update home operator |
|
2275 iReportGenerator->UpdateHomeOperator(iAppUi.GetHomeOperatorValue()); |
|
2276 iReportGenerator->UpdateNmsHomeOperator(iAppUi.GetHomeOperatorValue()); |
|
2277 |
|
2278 //user terminated |
|
2279 iReportGenerator->UpdateTerminatedBy(EUserTerminated); |
|
2280 //session ends due to error |
|
2281 iReportGenerator->SessionEndL(EFalse); |
|
2282 |
|
2283 TBool validate = iReportGenerator->ReStorePreviousSession(); |
|
2284 //restoring previous session |
|
2285 if (validate) |
|
2286 { |
|
2287 iSessionStart = ETrue; |
|
2288 } |
|
2289 else |
|
2290 { |
|
2291 iSessionStart=EFalse; |
|
2292 } |
|
2293 iSessionShouldNotEnd = EFalse; |
|
2294 |
|
2295 } |
|
2296 } |
|
2297 IRLOG_DEBUG( "CIRNowPlayingWrapper::LoadTerminateSession - Exiting." ); |
|
2298 } |
|
2299 // --------------------------------------------------------------------------- |
|
2300 // CIRNowPlayingWrapper::GetMediaClientInstance() |
|
2301 // Returns the Media Client Instance |
|
2302 // --------------------------------------------------------------------------- |
|
2303 // |
|
2304 CIRMediaClient* CIRNowPlayingWrapper::GetMediaClientInstance() |
|
2305 { |
|
2306 IRLOG_DEBUG( "CIRNowPlayingWrapper::GetMediaClientInstance " ); |
|
2307 return iPlayer; |
|
2308 } |
|
2309 // --------------------------------------------------------------------------- |
|
2310 // CIRNowPlayingWrapper::GetMediaClientInstance() |
|
2311 // Returns the ReportGenerator Instance |
|
2312 // --------------------------------------------------------------------------- |
|
2313 // |
|
2314 CIRReportGenerator* CIRNowPlayingWrapper::GetReportGeneratorInstance() |
|
2315 { |
|
2316 IRLOG_DEBUG( "CIRNowPlayingWrapper::GetReportGeneratorInstance " ); |
|
2317 return iReportGenerator; |
|
2318 } |
|
2319 |
|
2320 |
|
2321 // --------------------------------------------------------------------------- |
|
2322 // CIRNowPlayingWrapper::GetTerminatedLogOnCancelState() |
|
2323 // Returns the iTerminatedLogOnCancel Value |
|
2324 // --------------------------------------------------------------------------- |
|
2325 // |
|
2326 TBool CIRNowPlayingWrapper::GetTerminatedLogOnCancelState() |
|
2327 { |
|
2328 IRLOG_DEBUG( "CIRNowPlayingWrapper::GetTerminatedLogOnCancelState " ); |
|
2329 return iTerminatedLogOnCancel; |
|
2330 } |
|
2331 |
|
2332 // --------------------------------------------------------------------------- |
|
2333 // CIRNowPlayingWrapper::GetSessionStartState() |
|
2334 // Returns the iSessionStart Value |
|
2335 // --------------------------------------------------------------------------- |
|
2336 // |
|
2337 TBool CIRNowPlayingWrapper::GetSessionStartState() |
|
2338 { |
|
2339 IRLOG_DEBUG( "CIRNowPlayingWrapper::GetSessionStartState " ); |
|
2340 return iSessionStart; |
|
2341 } |
|
2342 // --------------------------------------------------------------------------- |
|
2343 // CIRNowPlayingWrapper::GetSessionStartedFlag() |
|
2344 // Returns the iSessionStarted Flag Value |
|
2345 // --------------------------------------------------------------------------- |
|
2346 // |
|
2347 TBool CIRNowPlayingWrapper::GetSessionStartedFlag() |
|
2348 { |
|
2349 IRLOG_DEBUG( "CIRNowPlayingWrapper::GetSessionStartedFlag " ); |
|
2350 return iSessionStartedFlag; |
|
2351 } |
|
2352 // --------------------------------------------------------------------------- |
|
2353 // CIRNowPlayingWrapper::SetSessionStartedFlag() |
|
2354 // Sets the iSessionStartedFlag Value |
|
2355 // --------------------------------------------------------------------------- |
|
2356 // |
|
2357 void CIRNowPlayingWrapper::SetSessionStartedFlag(TBool aSessionStartedFlag) |
|
2358 { |
|
2359 IRLOG_DEBUG( "CIRNowPlayingWrapper::SetSessionStartedFlag - Entering " ); |
|
2360 iSessionStartedFlag = aSessionStartedFlag; |
|
2361 IRLOG_DEBUG( "CIRNowPlayingWrapper::SetSessionStartedFlag - Exiting" ); |
|
2362 } |
|
2363 |
|
2364 // --------------------------------------------------------------------------- |
|
2365 // CIRNowPlayingWrapper::SetSessionStartState() |
|
2366 // Sets the iSessionStart Value |
|
2367 // --------------------------------------------------------------------------- |
|
2368 // |
|
2369 void CIRNowPlayingWrapper::SetSessionStartState(TBool aSessionStart) |
|
2370 { |
|
2371 IRLOG_DEBUG( "CIRNowPlayingWrapper::SetSessionStartState - Entering " ); |
|
2372 iSessionStart = aSessionStart; |
|
2373 IRLOG_DEBUG( "CIRNowPlayingWrapper::SetSessionStartState - Exiting" ); |
|
2374 } |
|
2375 // --------------------------------------------------------------------------- |
|
2376 // CIRNowPlayingWrapper::IsProgress() |
|
2377 // Returns the iProgress Value |
|
2378 // --------------------------------------------------------------------------- |
|
2379 // |
|
2380 TBool CIRNowPlayingWrapper::IsProgress() |
|
2381 { |
|
2382 IRLOG_DEBUG( "CIRNowPlayingWrapper::IsProgress " ); |
|
2383 return iProgress; |
|
2384 } |
|
2385 |
|
2386 |
|
2387 // --------------------------------------------------------------------------- |
|
2388 // CIRNowPlayingWrapper::SetConnectToServerState() |
|
2389 // Sets the iConnectToServer Value |
|
2390 // --------------------------------------------------------------------------- |
|
2391 // |
|
2392 void CIRNowPlayingWrapper::SetConnectToServerState(TBool aConnectToServer) |
|
2393 { |
|
2394 IRLOG_DEBUG( "CIRNowPlayingWrapper::SetConnectToServerState - Entering" ); |
|
2395 iConnectToServer = aConnectToServer; |
|
2396 IRLOG_DEBUG( "CIRNowPlayingWrapper::SetConnectToServerState - Exiting" ); |
|
2397 } |
|
2398 |
|
2399 // --------------------------------------------------------------------------- |
|
2400 // CIRNowPlayingWrapper::GetConnectToServerState() |
|
2401 // Returns the iConnectToServer Value |
|
2402 // --------------------------------------------------------------------------- |
|
2403 // |
|
2404 TBool CIRNowPlayingWrapper::GetConnectToServerState() |
|
2405 { |
|
2406 IRLOG_DEBUG( "CIRNowPlayingWrapper::SetConnectToServerState - Entering" ); |
|
2407 IRLOG_DEBUG( "CIRNowPlayingWrapper::SetConnectToServerState - Exiting" ); |
|
2408 return iConnectToServer ; |
|
2409 } |
|
2410 // CIRNowPlayingWrapper::CancelNetworkRequestL() |
|
2411 // Sets the iConnectToServer Value |
|
2412 // --------------------------------------------------------------------------- |
|
2413 // |
|
2414 void CIRNowPlayingWrapper::CancelNetworkRequestL() |
|
2415 { |
|
2416 IRLOG_DEBUG( "CIRNowPlayingWrapper::CanecelNetworkRequest - Entering" ); |
|
2417 if(iChannelConnect) |
|
2418 { |
|
2419 /**** ASF streaming changes : begin ****/ |
|
2420 if(!iAsfStreaming) |
|
2421 iNetwork->CancelRequest(); |
|
2422 /**** ASF streaming changes : end ****/ |
|
2423 if(iAppUi.GetNowPlayingViewInstance()->iContainer) |
|
2424 { |
|
2425 iLastPlayedUrl.Copy(iUnconnectedUrl); |
|
2426 iLastConnectedUrl.Copy(iUnconnectedUrl); |
|
2427 } |
|
2428 else |
|
2429 { |
|
2430 iUrl.Delete(0,iUrl.Length()); |
|
2431 iLastConnectedUrl.Zero(); |
|
2432 } |
|
2433 |
|
2434 LoadTerminateSessionL(); |
|
2435 } |
|
2436 else |
|
2437 { |
|
2438 iCancelNetworkRequest = ETrue; |
|
2439 ProgressBarCancel(); |
|
2440 } |
|
2441 IRLOG_DEBUG( "CIRNowPlayingWrapper::CanecelNetworkRequest - Exiting" ); |
|
2442 } |
|
2443 // --------------------------------------------------------------------------- |
|
2444 // CIRNowPlayingWrapper::SetVolumeL() |
|
2445 // Sets the Volume to Player |
|
2446 // --------------------------------------------------------------------------- |
|
2447 // |
|
2448 void CIRNowPlayingWrapper::SetVolumeL(TInt aIndex) |
|
2449 { |
|
2450 IRLOG_DEBUG( "CIRNowPlayingWrapper::SetVolume - Entering" ); |
|
2451 |
|
2452 /**** ASF streaming changes : begin ****/ |
|
2453 if(!iAsfStreaming && iPlayer) |
|
2454 { |
|
2455 TInt index = iPlayer->MaxVolume()/KNOVOLUMELEVELS; |
|
2456 TInt volume = index*aIndex; |
|
2457 iPlayer->SetVolume(volume); |
|
2458 } |
|
2459 else if(iAsfStreaming && iAsfPlayer) |
|
2460 { |
|
2461 TInt index = iAsfPlayer->MaxVolume()/KNOVOLUMELEVELS; |
|
2462 TInt volume = index*aIndex; |
|
2463 iAsfPlayer->SetVolume(volume); |
|
2464 } |
|
2465 /**** ASF streaming changes : end ****/ |
|
2466 |
|
2467 iIRSettings.SetVolumeSettingL(aIndex); |
|
2468 iAppUi.GetPubSubManagerInstance()->PublishVolume( iIRSettings.GetVolumeSetting() ); |
|
2469 IRLOG_DEBUG( "CIRNowPlayingWrapper::SetVolume - Exiting" ); |
|
2470 } |
|
2471 // --------------------------------------------------------------------------- |
|
2472 // CIRNowPlayingWrapper::GetPrevVolumeLevel() |
|
2473 // Sets the Volume to Player |
|
2474 // --------------------------------------------------------------------------- |
|
2475 // |
|
2476 TInt CIRNowPlayingWrapper::GetPrevVolumeLevel() |
|
2477 { |
|
2478 IRLOG_DEBUG( "CIRNowPlayingWrapper::GetPrevVolumeLevel" ); |
|
2479 return iPrevVolumeLevel; |
|
2480 } |
|
2481 // --------------------------------------------------------------------------- |
|
2482 // CIRNowPlayingWrapper::SetPrevVolumeLevel() |
|
2483 // Sets the Volume to Player |
|
2484 // --------------------------------------------------------------------------- |
|
2485 // |
|
2486 void CIRNowPlayingWrapper::SetPrevVolumeLevel(TInt aPrevVolume) |
|
2487 { |
|
2488 IRLOG_DEBUG( "CIRNowPlayingWrapper::SetPrevVolumeLevel - Entering" ); |
|
2489 iPrevVolumeLevel = aPrevVolume; |
|
2490 IRLOG_DEBUG( "CIRNowPlayingWrapper::SetPrevVolumeLevel - Exiting" ); |
|
2491 } |
|
2492 // --------------------------------------------------------------------------- |
|
2493 // CIRNowPlayingWrapper::SetPrevVolumeLevel() |
|
2494 // Sets the Volume to Player |
|
2495 // --------------------------------------------------------------------------- |
|
2496 // |
|
2497 void CIRNowPlayingWrapper:: SetMetadataL() |
|
2498 { |
|
2499 IRLOG_DEBUG( "CIRNowPlayingWrapper::SetMetadata() - Entering" ); |
|
2500 iMetaData->SetArtistL(KConst); |
|
2501 iMetaData->SetSongL( KConst ); |
|
2502 IRLOG_DEBUG( "CIRNowPlayingWrapper::SetMetadata() - Exiting" ); |
|
2503 |
|
2504 } |
|
2505 // --------------------------------------------------------------------------- |
|
2506 // CIRNowPlayingWrapper::PublishDataL() |
|
2507 // Publishes the Metadata |
|
2508 // --------------------------------------------------------------------------- |
|
2509 // |
|
2510 void CIRNowPlayingWrapper:: PublishDataL() |
|
2511 { |
|
2512 IRLOG_DEBUG( "CIRNowPlayingWrapper::PublishDataL() - Entering" ); |
|
2513 |
|
2514 iAppUi.GetPubSubManagerInstance()->PublishChannel( iNowPlayingPreset->GetName() ); |
|
2515 iAppUi.GetPubSubManagerInstance()->PublishMetaDataL( *iMetaData ); |
|
2516 iAppUi.GetPubSubManagerInstance()->PublishChannelType( |
|
2517 iNowPlayingPreset->GetChannelType()); |
|
2518 iAppUi.GetPubSubManagerInstance()->PublishChannelId(iNowPlayingPreset->GetId()); |
|
2519 iAppUi.GetPubSubManagerInstance()->PublishChannelDesc( |
|
2520 iNowPlayingPreset->GetShortDescription()); |
|
2521 if(iNowPlayingPreset->GetChannelType()==1) |
|
2522 { |
|
2523 iAppUi.GetPubSubManagerInstance()->PublishChannelMusicFlag( |
|
2524 iNowPlayingPreset->GetMusicStoreStatus()); |
|
2525 } |
|
2526 if(iAppUi.GetNowPlayingViewInstance()) |
|
2527 { |
|
2528 iAppUi.GetNowPlayingViewInstance()->UpdateLastplayedL(); |
|
2529 } |
|
2530 IRLOG_DEBUG( "CIRNowPlayingWrapper::PublishDataL() - Exiting" ); |
|
2531 |
|
2532 } |
|
2533 // --------------------------------------------------------------------------- |
|
2534 // CIRNowPlayingWrapper::StopPlayerL() |
|
2535 // Stops the Player |
|
2536 // --------------------------------------------------------------------------- |
|
2537 // |
|
2538 void CIRNowPlayingWrapper::StopPlayer() |
|
2539 { |
|
2540 IRLOG_DEBUG( "CIRNowPlayingWrapper::StopPlayerL() - Entering" ); |
|
2541 |
|
2542 /**** ASF streaming changes : begin ****/ |
|
2543 if(!iAsfStreaming && iPlayer) |
|
2544 { |
|
2545 iPlayer->Stop(); |
|
2546 DoPlayingStateChanged(EFalse); |
|
2547 iPlayandStop=EFalse; |
|
2548 } |
|
2549 else if(iAsfStreaming && iAsfPlayer) |
|
2550 { |
|
2551 iAsfPlayer->Stop(); |
|
2552 iAsfStreaming = EFalse; |
|
2553 DoPlayingStateChanged(EFalse); |
|
2554 } |
|
2555 if(iAppUi.ActiveView() == KIRMainChoiceViewID) |
|
2556 { |
|
2557 TRAP_IGNORE(iAppUi.iMainView->GetMainContainer()->UpdateAllL();) |
|
2558 } |
|
2559 /**** ASF streaming changes : end ****/ |
|
2560 |
|
2561 IRLOG_DEBUG( "CIRNowPlayingWrapper::StopPlayerL() - Exiting" ); |
|
2562 } |
|
2563 |
|
2564 // --------------------------------------------------------------------------- |
|
2565 // CIRNowPlayingWrapper::SetMedadataForErrotrConditions() |
|
2566 // Sets the iDisplayMetaData Flag When Handling the Context Navigation |
|
2567 // --------------------------------------------------------------------------- |
|
2568 // |
|
2569 void CIRNowPlayingWrapper::SetMedadataForErrotrConditions(TBool aDisplayMetaData) |
|
2570 { |
|
2571 IRLOG_DEBUG( "CIRNowPlayingWrapper::SetMedadataForErrotrConditions() - Entering" ); |
|
2572 |
|
2573 iDisplayMetaData=aDisplayMetaData; |
|
2574 IRLOG_DEBUG( "CIRNowPlayingWrapper::SetMedadataForErrotrConditions() - Exiting" ); |
|
2575 |
|
2576 } |
|
2577 |
|
2578 // --------------------------------------------------------------------------- |
|
2579 // CIRNowPlayingWrapper::GetMedadataForErrotrConditions() |
|
2580 // Returns the iDisplayMetaData Flag When Handling the Context Navigation |
|
2581 // --------------------------------------------------------------------------- |
|
2582 // |
|
2583 |
|
2584 TBool CIRNowPlayingWrapper::GetMedadataForErrotrConditions() |
|
2585 { |
|
2586 IRLOG_DEBUG( "CIRNowPlayingWrapper::GetMedadataForErrotrConditions() - Entering" ); |
|
2587 IRLOG_DEBUG( "CIRNowPlayingWrapper::GetMedadataForErrotrConditions() - Exiting" ); |
|
2588 return iDisplayMetaData; |
|
2589 } |
|
2590 // --------------------------------------------------------------------------- |
|
2591 // CIRNowPlayingWrapper::GetMarquee() |
|
2592 // Returns the iMarQuee which is Set During HandleMetadataReceived |
|
2593 // --------------------------------------------------------------------------- |
|
2594 // |
|
2595 |
|
2596 TBool CIRNowPlayingWrapper::GetMarquee() |
|
2597 { |
|
2598 IRLOG_DEBUG( "CIRNowPlayingWrapper::GetMarquee() - Entering" ); |
|
2599 IRLOG_DEBUG( "CIRNowPlayingWrapper::GetMarquee() - Exiting" ); |
|
2600 return iMarquee; |
|
2601 } |
|
2602 // --------------------------------------------------------------------------- |
|
2603 // CIRNowPlayingWrapper::SetMarquee() |
|
2604 // Sets the Marquee value required for NowPlaying view |
|
2605 // --------------------------------------------------------------------------- |
|
2606 // |
|
2607 void CIRNowPlayingWrapper::SetMarquee(TBool aMarquee) |
|
2608 { |
|
2609 IRLOG_DEBUG( "CIRNowPlayingWrapper::SetMarquee() - Entering" ); |
|
2610 |
|
2611 iMarquee=aMarquee; |
|
2612 |
|
2613 IRLOG_DEBUG( "CIRNowPlayingWrapper::SetMarquee() - Exiting" ); |
|
2614 |
|
2615 } |
|
2616 // --------------------------------------------------------------------------- |
|
2617 // CIRNowPlayingWrapper::SetView() |
|
2618 // Set by Every View to its TIRViews when Listen is Done |
|
2619 // --------------------------------------------------------------------------- |
|
2620 // |
|
2621 |
|
2622 void CIRNowPlayingWrapper:: SetView(TIRViews aContextViews) |
|
2623 { |
|
2624 IRLOG_DEBUG( "CIRNowPlayingWrapper::SetView() - Entering" ); |
|
2625 |
|
2626 iContextViews=aContextViews; |
|
2627 IRLOG_DEBUG( "CIRNowPlayingWrapper::SetView() - Exiting" ); |
|
2628 |
|
2629 } |
|
2630 // --------------------------------------------------------------------------- |
|
2631 // CIRNowPlayingWrapper::GetView() |
|
2632 // Returns the View Where Listen Has Done |
|
2633 // --------------------------------------------------------------------------- |
|
2634 // |
|
2635 TIRViews CIRNowPlayingWrapper:: GetView() |
|
2636 { |
|
2637 IRLOG_DEBUG( "CIRNowPlayingWrapper::GetView() - Entering" ); |
|
2638 IRLOG_DEBUG( "CIRNowPlayingWrapper::GetView() - Exiting" ); |
|
2639 return iContextViews; |
|
2640 } |
|
2641 // --------------------------------------------------------------------------- |
|
2642 // CIRUi::SetAudioVolume() |
|
2643 // function set the volume |
|
2644 // --------------------------------------------------------------------------- |
|
2645 // |
|
2646 void CIRNowPlayingWrapper::SetAudioVolume(TInt aValue) |
|
2647 { |
|
2648 IRLOG_INFO2( "CIRNowPlayingWrapper::SetAudioVolume(aValue=%d)", aValue ); |
|
2649 |
|
2650 /**** ASF streaming changes : begin ****/ |
|
2651 if(!iAsfStreaming) |
|
2652 { |
|
2653 TInt index = iPlayer->MaxVolume()/KNOVOLUMELEVELS; |
|
2654 TInt volume = aValue * index; |
|
2655 //volume level between zero volume and maximum volume of |
|
2656 //device is taken, if volume is beyound these limit it is not set |
|
2657 if( (0 <= volume) && (iPlayer->MaxVolume() >= volume) ) |
|
2658 { |
|
2659 iPlayer->SetVolume(volume); |
|
2660 } |
|
2661 } |
|
2662 else |
|
2663 { |
|
2664 TInt index = iAsfPlayer->MaxVolume()/KNOVOLUMELEVELS; |
|
2665 TInt volume = aValue * index; |
|
2666 //volume level between zero volume and maximum volume of |
|
2667 //device is taken, if volume is beyound these limit it is not set |
|
2668 if( (0 <= volume) && (iAsfPlayer->MaxVolume() >= volume) ) |
|
2669 { |
|
2670 iAsfPlayer->SetVolume(volume); |
|
2671 } |
|
2672 } |
|
2673 /**** ASF streaming changes : end ****/ |
|
2674 |
|
2675 |
|
2676 IRLOG_DEBUG( "CIRNowPlayingWrapper::SetAudioVolume - Exiting." ); |
|
2677 } |
|
2678 // --------------------------------------------------------------------------- |
|
2679 // CreateWaitDialogL() |
|
2680 // Creates the waitDialog Required While Connecting To a Channel |
|
2681 // --------------------------------------------------------------------------- |
|
2682 // |
|
2683 |
|
2684 void CIRNowPlayingWrapper::CreateWaitDialogL() |
|
2685 { |
|
2686 IRLOG_DEBUG( "CIRNowPlayingWrapper::CreateWaitDialogL - Entering" ); |
|
2687 |
|
2688 HBufC* bufferText = StringLoader::LoadLC(R_IRAPP_LOADING_BUFFERING); |
|
2689 if(!iWaitDialog) |
|
2690 { |
|
2691 iWaitDialog = new ( ELeave ) CAknWaitDialog( NULL,ETrue); |
|
2692 iWaitDialog->SetCallback(this); |
|
2693 iWaitDialog->ExecuteLD(R_IRAPP_PROGRESS_DIALOG); |
|
2694 iWaitDialog->SetTextL(*bufferText); |
|
2695 iBufferigSteamText=EFalse; |
|
2696 } |
|
2697 CleanupStack::PopAndDestroy(bufferText); |
|
2698 |
|
2699 IRLOG_DEBUG( "CIRNowPlayingWrapper::CreateWaitDialogL - exiting." ); |
|
2700 } |
|
2701 // --------------------------------------------------------------------------- |
|
2702 // DestroyWaitDialogL() |
|
2703 // Destroys The WaitDialog |
|
2704 // --------------------------------------------------------------------------- |
|
2705 // |
|
2706 |
|
2707 void CIRNowPlayingWrapper::DestroyWaitDialogL() |
|
2708 { |
|
2709 |
|
2710 IRLOG_DEBUG( "CIRNowPlayingWrapper::DestroyWaitDialogL - Entering" ); |
|
2711 |
|
2712 if(iWaitDialog) |
|
2713 { |
|
2714 iWaitDialog->ProcessFinishedL(); |
|
2715 iWaitDialog=NULL; |
|
2716 iDialogCanceled=ETrue; |
|
2717 iBufferingRequestCancelled=ETrue; |
|
2718 } |
|
2719 |
|
2720 IRLOG_DEBUG( "CIRNowPlayingWrapper::DestroyWaitDialogL - exiting." ); |
|
2721 } |
|
2722 |
|
2723 // --------------------------------------------------------------------------- |
|
2724 // SetProgress() |
|
2725 // Sets the Progress Value |
|
2726 // --------------------------------------------------------------------------- |
|
2727 // |
|
2728 |
|
2729 void CIRNowPlayingWrapper::SetProgress(TBool aProgress) |
|
2730 { |
|
2731 IRLOG_DEBUG( "CIRNowPlayingWrapper::SetProgress - Entering" ); |
|
2732 iProgress=aProgress; |
|
2733 IRLOG_DEBUG( "CIRNowPlayingWrapper::SetProgress - exiting." ); |
|
2734 } |
|
2735 // --------------------------------------------------------------------------- |
|
2736 // GetChannelConnetedInfo() |
|
2737 // Returns Whether the channel connected or not |
|
2738 // --------------------------------------------------------------------------- |
|
2739 // |
|
2740 |
|
2741 TBool CIRNowPlayingWrapper::GetChannelConnetedInfo() |
|
2742 { |
|
2743 IRLOG_DEBUG( "CIRNowPlayingWrapper::GetChannelConnetedInfo - Entering" ); |
|
2744 IRLOG_DEBUG( "CIRNowPlayingWrapper::GetChannelConnetedInfo - exiting." ); |
|
2745 return iChannelConnected; |
|
2746 } |
|
2747 // --------------------------------------------------------------------------- |
|
2748 // HandleNetworkDisconnected() |
|
2749 // Function called when network got disconnected While Buffering |
|
2750 // --------------------------------------------------------------------------- |
|
2751 // |
|
2752 |
|
2753 void CIRNowPlayingWrapper::HandleNetworkDisconnected() |
|
2754 { |
|
2755 IRLOG_DEBUG( "CIRNowPlayingWrapper::HandleNetworkDisconnected - Entering" ); |
|
2756 |
|
2757 iAppUi.iNetworkController->ResetConnectionStatus(); |
|
2758 if(!iAppUi.iIsDisconnected) |
|
2759 { |
|
2760 if(iAppUi.iMainView->iSyncReq) |
|
2761 { |
|
2762 iAppUi.iIsdsWrapper->GetISDSInstance()->IRISDSCancelRequest(); |
|
2763 TRAP_IGNORE(DestroyWaitDialogL();) |
|
2764 } |
|
2765 if(iConnectToServer && !iProgress) |
|
2766 { |
|
2767 TRAP_IGNORE(DestroyWaitDialogL();) |
|
2768 TRAP_IGNORE(CancelNetworkRequestL();) |
|
2769 } |
|
2770 if(iProgress) |
|
2771 { |
|
2772 //if in progress bar view, progress bar is cancelled |
|
2773 TRAP_IGNORE(DestroyWaitDialogL();) |
|
2774 ProgressBarCancel(); |
|
2775 } |
|
2776 if ( iAppUi.iIsdsWrapper->GetISDSInstance() ) |
|
2777 { |
|
2778 if(iAppUi.iIsdsWrapper->GetListenRequest()) |
|
2779 { |
|
2780 TRAP_IGNORE(DestroyWaitDialogL();) |
|
2781 } |
|
2782 TRAP_IGNORE(iAppUi.iIsdsWrapper->DestroyWaitDialogL();) |
|
2783 iAppUi.iIsdsWrapper->GetISDSInstance()->IRISDSCancelRequest(); |
|
2784 iAppUi.iIsdsWrapper->GetISDSInstance()->ReleaseResources(); |
|
2785 } |
|
2786 } |
|
2787 IRLOG_DEBUG( "CIRNowPlayingWrapper::HandleNetworkDisconnected - exiting." ); |
|
2788 } |
|
2789 // --------------------------------------------------------------------------- |
|
2790 // HandleNetworkEstablished() |
|
2791 // Function called when network Connection Established In ALr |
|
2792 // --------------------------------------------------------------------------- |
|
2793 // |
|
2794 |
|
2795 void CIRNowPlayingWrapper::HandleNetworkEstablished() |
|
2796 { |
|
2797 if(!iPlaying) |
|
2798 { |
|
2799 iLastConnectedUrl.Zero(); |
|
2800 iLastPlayedUrl.Zero(); |
|
2801 if((iAppUi.GetNowPlayingViewInstance()->iContainer)) |
|
2802 { |
|
2803 if(iSyncPreset) |
|
2804 { |
|
2805 iAppUi.iNowPlayingView->SetRockerIndex( |
|
2806 iAppUi.iNowPlayingView->GetPreviousIndex()); |
|
2807 TRAP_IGNORE(TriggerCommandL(iAppUi.GetNowPlayingViewInstance()->GetCommandId());) |
|
2808 return; |
|
2809 } |
|
2810 } |
|
2811 //iLastPlayedUrl.Zero() |
|
2812 if(iAppUi.iIsdsWrapper->GetListenRequest()) |
|
2813 { |
|
2814 IRRDEBUG2("CIRNowPlayingWrapper:: HandleNetworkEstablished1", KNullDesC); |
|
2815 |
|
2816 if(!(iAppUi.GetNowPlayingViewInstance()->iContainer)) |
|
2817 { |
|
2818 if(!iBufferingRequestCancelled) |
|
2819 { |
|
2820 iLaunchNowplaying=EFalse; |
|
2821 } |
|
2822 else |
|
2823 { |
|
2824 iLaunchNowplaying=ETrue; |
|
2825 } |
|
2826 } |
|
2827 if(iAppUi.GetNowPlayingViewInstance()->iContainer) |
|
2828 { |
|
2829 iAppUi.iNowPlayingView->SetRockerIndex( |
|
2830 iAppUi.iNowPlayingView->GetPreviousIndex()); |
|
2831 TRAP_IGNORE(TriggerCommandL(iAppUi.GetNowPlayingViewInstance()->GetCommandId());) |
|
2832 } |
|
2833 else |
|
2834 { |
|
2835 TRAP_IGNORE(TriggerCommandL(EListenCmd);) |
|
2836 } |
|
2837 } |
|
2838 else if(iConnectToServer && !iPlaying) |
|
2839 { |
|
2840 |
|
2841 if(!(iAppUi.GetNowPlayingViewInstance()->iContainer)) |
|
2842 { |
|
2843 if(!iBufferingRequestCancelled) |
|
2844 { |
|
2845 iLaunchNowplaying=EFalse; |
|
2846 } |
|
2847 else |
|
2848 { |
|
2849 iLaunchNowplaying=ETrue; |
|
2850 } |
|
2851 } |
|
2852 else |
|
2853 { |
|
2854 iLaunchNowplaying=ETrue; |
|
2855 } |
|
2856 iNotify=ETrue; |
|
2857 iQualityRequired=-1; |
|
2858 TRAP_IGNORE(ConnectToChannelL(*iNowPlayingPreset);) |
|
2859 } |
|
2860 |
|
2861 } |
|
2862 |
|
2863 } |
|
2864 |
|
2865 // --------------------------------------------------------------------------- |
|
2866 // Triggers the command to view handling |
|
2867 // --------------------------------------------------------------------------- |
|
2868 // |
|
2869 void CIRNowPlayingWrapper::TriggerCommandL( TInt iCommandId) |
|
2870 { |
|
2871 IRLOG_DEBUG( "CIRNowPlayingViewContainer::TriggerCommandL - Entering" ); |
|
2872 TVwsViewId viewId( KNullUid, KNullUid ); |
|
2873 CAknViewAppUi* appUi = static_cast<CAknViewAppUi*>( CCoeEnv::Static()->AppUi() ); |
|
2874 TInt err = appUi->GetActiveViewId( viewId ); |
|
2875 RProcess process; |
|
2876 TSecureId id = process.SecureId(); |
|
2877 // TO be DOne GetActiveViewId doesn't always work (when switched back to VRA through RadioLauncher icon |
|
2878 if( !err && viewId.iAppUid.iUid == id.iId ) |
|
2879 { |
|
2880 CAknView* view = appUi->View( viewId.iViewUid ); |
|
2881 if( view ) |
|
2882 { |
|
2883 view->ProcessCommandL( iCommandId ); |
|
2884 } |
|
2885 } |
|
2886 IRLOG_DEBUG( "CIRNowPlayingViewContainer::TriggerCommandL - Exiting" ); |
|
2887 } |
|
2888 |
|
2889 // --------------------------------------------------------------------------- |
|
2890 // CIRNowPlayingWrapper::RemoveWhiteSpace( TDes& aBuf ) |
|
2891 // Called from HandleMetaDataReceivedL. |
|
2892 // --------------------------------------------------------------------------- |
|
2893 // |
|
2894 void CIRNowPlayingWrapper::RemoveWhiteSpace( TDes& aBuf ) |
|
2895 { |
|
2896 _LIT(KNewLine, "\n"); |
|
2897 _LIT(KCharLine, "\r"); |
|
2898 _LIT(KTab, "\t"); |
|
2899 _LIT(KSpace, " "); |
|
2900 |
|
2901 TInt index = aBuf.Find(KNewLine); |
|
2902 while (index != KErrNotFound) |
|
2903 { |
|
2904 aBuf.Replace(index, 1, KSpace); |
|
2905 index = aBuf.Find(KNewLine); |
|
2906 } |
|
2907 |
|
2908 index = aBuf.Find(KCharLine); |
|
2909 while (index != KErrNotFound) |
|
2910 { |
|
2911 aBuf.Replace(index, 1, KSpace); |
|
2912 index = aBuf.Find(KCharLine); |
|
2913 } |
|
2914 |
|
2915 index = aBuf.Find(KTab); |
|
2916 while (index != KErrNotFound) |
|
2917 { |
|
2918 aBuf.Replace(index, 1, KSpace); |
|
2919 index = aBuf.Find(KTab); |
|
2920 } |
|
2921 |
|
2922 aBuf.TrimAll(); |
|
2923 } |
|
2924 // --------------------------------------------------------------------------- |
|
2925 // CIRNowPlayingWrapper::CheckCallStatusL |
|
2926 // Checks the Call status Whether it is Incoming Call or OutGoing Call |
|
2927 // --------------------------------------------------------------------------- |
|
2928 // |
|
2929 TBool CIRNowPlayingWrapper::CheckCallStatusL() |
|
2930 { |
|
2931 CTelephony* telephony = CTelephony::NewLC(); |
|
2932 |
|
2933 CTelephony::TCallInfoV1 callInfoV1; |
|
2934 CTelephony::TCallInfoV1Pckg callInfoV1Pckg( callInfoV1 ); |
|
2935 |
|
2936 CTelephony::TCallSelectionV1 callSelectionV1; |
|
2937 CTelephony::TCallSelectionV1Pckg callSelectionV1Pckg( callSelectionV1 ); |
|
2938 |
|
2939 CTelephony::TRemotePartyInfoV1 remotePartyInfoV1; |
|
2940 CTelephony::TRemotePartyInfoV1Pckg remotePartyInfoV1Pckg( remotePartyInfoV1 ); |
|
2941 |
|
2942 callSelectionV1.iLine = CTelephony::EVoiceLine; |
|
2943 callSelectionV1.iSelect =CTelephony::EInProgressCall; |
|
2944 |
|
2945 telephony->GetCallInfo( callSelectionV1Pckg, callInfoV1Pckg, remotePartyInfoV1Pckg ); |
|
2946 CTelephony::TCallDirection iDirection1; |
|
2947 iDirection1=CTelephony::EMobileOriginated; |
|
2948 |
|
2949 if(remotePartyInfoV1.iDirection==iDirection1) |
|
2950 { |
|
2951 iPlaying=ETrue; |
|
2952 CleanupStack::PopAndDestroy( telephony ); |
|
2953 return ETrue; |
|
2954 |
|
2955 } |
|
2956 CleanupStack::PopAndDestroy( telephony ); |
|
2957 IRLOG_DEBUG( "CIRNowPlayingWrapper::NotifyActiveNetworkObserversL - Entering" ); |
|
2958 return EFalse; |
|
2959 } |
|
2960 |
|
2961 // --------------------------------------------------------------------------- |
|
2962 //Notifies all observers whose network request is active |
|
2963 // to reissue the request |
|
2964 //NotifyActiveNetworkObserversL() |
|
2965 // --------------------------------------------------------------------------- |
|
2966 |
|
2967 void CIRNowPlayingWrapper::NotifyActiveNetworkObserversL(TIRNetworkEvent aEvent) |
|
2968 { |
|
2969 IRLOG_DEBUG( "CIRNowPlayingWrapper::NotifyActiveNetworkObserversL - Entering" ); |
|
2970 |
|
2971 switch(aEvent) |
|
2972 { |
|
2973 case ENetworkConnectionDisconnected: |
|
2974 { |
|
2975 if(!iAppUi.iIsDisconnected) |
|
2976 { |
|
2977 if(iAppUi.GetNowPlayingViewInstance()->iContainer) |
|
2978 { |
|
2979 if(iSyncPreset) |
|
2980 { |
|
2981 if((iAppUi.iNowPlayingView->iContainer)) |
|
2982 { |
|
2983 iAppUi.iNowPlayingView->SetRockerIndex( |
|
2984 iAppUi.iNowPlayingView->GetPreviousIndex()); |
|
2985 } |
|
2986 |
|
2987 } |
|
2988 IRRDEBUG2("CIRNowPlayingWrapper::ENetworkConnectionDisconnected1 - Entering ", KNullDesC); |
|
2989 if(iAppUi.iIsdsWrapper->GetListenRequest()||iSyncPreset) |
|
2990 { |
|
2991 TRAP_IGNORE(DestroyWaitDialogL();) |
|
2992 iAppUi.iIsdsWrapper->GetISDSInstance()->IRISDSCancelRequest(); |
|
2993 } |
|
2994 if(iPlaying && !iProgress) |
|
2995 { |
|
2996 |
|
2997 StopNow(); |
|
2998 if(iAppUi.ActiveView() == KIRMainChoiceViewID) |
|
2999 { |
|
3000 iAppUi.iMainView->GetMainContainer()->UpdateAllL(); |
|
3001 } |
|
3002 } |
|
3003 else |
|
3004 { |
|
3005 if(iConnectToServer && !iProgress) |
|
3006 { |
|
3007 |
|
3008 CancelNetworkRequestL(); |
|
3009 DestroyWaitDialogL(); |
|
3010 } |
|
3011 if(iProgress) |
|
3012 { |
|
3013 //if in progress bar view, progress bar is cancelled |
|
3014 DestroyWaitDialogL(); |
|
3015 ProgressBarCancel(); |
|
3016 } |
|
3017 } |
|
3018 } |
|
3019 |
|
3020 } |
|
3021 } |
|
3022 break; |
|
3023 |
|
3024 case ENetworkConnectionEstablished: |
|
3025 { |
|
3026 if(!iAppUi.IsCallActive()) |
|
3027 { |
|
3028 if(iAppUi.iNetworkController->IsHandingOverConnection()) |
|
3029 { |
|
3030 iAppUi.GetNowPlayingViewInstance()->SetRequestPendingWhenNoNetWork(EFalse); |
|
3031 iAppUi.GetNowPlayingViewInstance()->SetRequestPendingWhenNoNetWorkForNextOrPrev(EFalse); |
|
3032 if(!iPlaying) |
|
3033 { |
|
3034 |
|
3035 HandleNetworkEstablished(); |
|
3036 } |
|
3037 } |
|
3038 else if(iAppUi.GetNowPlayingViewInstance()->GetRequestPending()) |
|
3039 { |
|
3040 PlayAndStopL(); |
|
3041 } |
|
3042 else if(iAppUi.GetNowPlayingViewInstance()->GetRequestPendingForNextOrPreV()) |
|
3043 { |
|
3044 if(iContextViews==EFav||iContextViews==EPls) |
|
3045 { |
|
3046 iAppUi.GetNowPlayingViewInstance()->ConnectToPresetL(); |
|
3047 iAppUi.GetNowPlayingViewInstance()->StartTimerL(); |
|
3048 } |
|
3049 else |
|
3050 { |
|
3051 iAppUi.GetNowPlayingViewInstance()->ConnectToPresetL(); |
|
3052 } |
|
3053 } |
|
3054 } |
|
3055 ResetPendingRequests(EFalse); |
|
3056 } |
|
3057 break; |
|
3058 default: |
|
3059 break; |
|
3060 } |
|
3061 |
|
3062 IRLOG_DEBUG( "CIRNowPlayingWrapper::NotifyActiveNetworkObserversL - Exiting" ); |
|
3063 } |
|
3064 |
|
3065 |
|
3066 |
|
3067 // ----------------------------------------------------------------------------- |
|
3068 // Notified by network controller when user cancels network connection, to reset |
|
3069 // the pending requests |
|
3070 // ResetPendingRequests() |
|
3071 // ----------------------------------------------------------------------------- |
|
3072 void CIRNowPlayingWrapper::ResetPendingRequests(TBool aValue) |
|
3073 { |
|
3074 iAppUi.GetNowPlayingViewInstance()->SetRequestPendingWhenNoNetWork(aValue); |
|
3075 iAppUi.GetNowPlayingViewInstance()->SetRequestPendingWhenNoNetWorkForNextOrPrev(aValue); |
|
3076 } |
|
3077 |
|
3078 /**** Added for ASF streaming - begin *****/ |
|
3079 |
|
3080 // --------------------------------------------------------------------------- |
|
3081 // MIRStreamSourceObserver::Asf_ErrorConnecting() |
|
3082 // Called when there is an error when connecting to the channel server @Param aErrorCode Indicates the type of error as described in irstreamsourceerrors.h--------------------------------------------------------------------------- |
|
3083 // --------------------------------------------------------------------------- |
|
3084 // |
|
3085 void CIRNowPlayingWrapper::Asf_ErrorConnecting(TInt aErrorCode) |
|
3086 { |
|
3087 IRLOG_DEBUG2( "CIRNowPlayingWrapper::Asf_ErrorConnecting(aErrorCode=%d)", aErrorCode ); |
|
3088 ErrorConnecting( aErrorCode ); |
|
3089 IRLOG_DEBUG( "CIRNowPlayingWrapper::Asf_ErrorConnecting - Exiting." ); |
|
3090 } |
|
3091 |
|
3092 // --------------------------------------------------------------------------- |
|
3093 // MIRStreamSourceObserver::Asf_ConnectionEstablished(TInt aFeedValue) |
|
3094 // Called to indicate that the connection to channel server is sucessful |
|
3095 // --------------------------------------------------------------------------- |
|
3096 // |
|
3097 void CIRNowPlayingWrapper::Asf_ConnectionEstablished() |
|
3098 { |
|
3099 IRLOG_INFO( "CIRNowPlayingWrapper::Asf_ConnectionEstablished - Entering." ); |
|
3100 ConnectionEstablished(); |
|
3101 IRLOG_DEBUG( "CIRNowPlayingWrapper::Asf_ConnectionEstablished - Exiting." ); |
|
3102 } |
|
3103 |
|
3104 // --------------------------------------------------------------------------- |
|
3105 // MIRStreamSourceObserver::Asf_UpdateProgress() |
|
3106 // Called to provide teh buffer values @param aFeedValue used to pump the buffering value |
|
3107 // --------------------------------------------------------------------------- |
|
3108 // |
|
3109 void CIRNowPlayingWrapper::Asf_UpdateProgress(TInt aFeedValue) |
|
3110 { |
|
3111 IRLOG_DEBUG( "CIRNowPlayingWrapper::Asf_UpdateProgress - Entering" ); |
|
3112 UpdateProgress(aFeedValue); |
|
3113 IRLOG_DEBUG( "CIRNowPlayingWrapper::Asf_UpdateProgress - Exiting." ); |
|
3114 } |
|
3115 |
|
3116 // --------------------------------------------------------------------------- |
|
3117 // MCrtlCmdCommand::Asf_HandleMetaDataReceivedL() |
|
3118 // Invoked when meta data is received. @param aMetaData The meta data that was received. |
|
3119 // --------------------------------------------------------------------------- |
|
3120 // |
|
3121 void CIRNowPlayingWrapper::Asf_HandleMetaDataReceivedL( const CIRMetaData& aMetaData ) |
|
3122 { |
|
3123 IRLOG_DEBUG( "CIRNowPlayingWrapper::Asf_HandleMetaDataReceivedL - Entering" ); |
|
3124 HandleMetaDataReceivedL( aMetaData ); |
|
3125 IRLOG_DEBUG( "CIRNowPlayingWrapper::Asf_HandleMetaDataReceivedL - Exiting." ); |
|
3126 } |
|
3127 |
|
3128 /**** Added for ASF streaming - end *****/ |
|
3129 |
|
3130 // --------------------------------------------------------------------------- |
|
3131 // UpdateNmsLogEventsL() |
|
3132 // Updates Nms Log events |
|
3133 // --------------------------------------------------------------------------- |
|
3134 |
|
3135 void CIRNowPlayingWrapper::UpdateNmsLogEventsL(const TDesC& aNmsType) |
|
3136 { |
|
3137 IRLOG_DEBUG( "CIRNowPlayingWrapper::UpdateNmsLogEventsL - Entering" ); |
|
3138 |
|
3139 iReportGenerator->UpdateNmsCurrentNetwork(iAppUi.GetCurrentOperatorValue()); |
|
3140 iReportGenerator->UpdateNmsHomeOperator(iAppUi.GetHomeOperatorValue()); |
|
3141 iReportGenerator->UpdateNmsChannelID(iNowPlayingPreset->GetId()); |
|
3142 iReportGenerator->UpdateNmsType(aNmsType); |
|
3143 iReportGenerator->SessionStartedL(); |
|
3144 iReportGenerator->WriteNmsLogtoXmlL(); |
|
3145 |
|
3146 IRLOG_DEBUG( "CIRNowPlayingWrapper::UpdateNmsLogEventsL - exiting." ); |
|
3147 } |
|
3148 |
|
3149 /* This is reuired Only Accp or Acc type check |
|
3150 // --------------------------------------------------------------------------- |
|
3151 // GetSupportedMimeTypeL() |
|
3152 // Function Evaluates the Suppoeted Mime Types |
|
3153 // --------------------------------------------------------------------------- |
|
3154 // |
|
3155 |
|
3156 TInt CIRNowPlayingWrapper::GetSupportedMimeTypeL() |
|
3157 { |
|
3158 IRLOG_DEBUG( "CIRNowPlayingWrapper::GetSupportedMimeTypeL - Entering" ); |
|
3159 // _LIT(KAudiContent,"aacp")//aacp |
|
3160 TInt findContent=KErrNotFound; |
|
3161 TInt i,ii,j; |
|
3162 CMMFControllerPluginSelectionParameters *cs=CMMFControllerPluginSelectionParameters::NewLC(); |
|
3163 CMMFFormatSelectionParameters * fs = CMMFFormatSelectionParameters::NewLC(); |
|
3164 cs->SetRequiredPlayFormatSupportL(*fs); |
|
3165 cs->SetRequiredRecordFormatSupportL(*fs); |
|
3166 |
|
3167 RMMFControllerImplInfoArray controllers; |
|
3168 CleanupResetAndDestroyPushL(controllers); |
|
3169 cs->ListImplementationsL(controllers); |
|
3170 TBuf<KSize>z1; |
|
3171 z1.Copy(iNetwork->ContentTypeL()); |
|
3172 TBool checkMime=EFalse; |
|
3173 TInt contrCount = controllers.Count(); |
|
3174 for(i=0;i<controllers.Count();i++) |
|
3175 { |
|
3176 //supported play formats |
|
3177 const RMMFFormatImplInfoArray &pf=controllers[i]->PlayFormats(); |
|
3178 TInt pfCount = pf.Count(); |
|
3179 for(ii=0;ii<pf.Count();ii++) |
|
3180 { |
|
3181 TBuf<KSize> z; |
|
3182 //file extensions |
|
3183 const CDesC8Array &fe=pf[ii]->SupportedFileExtensions(); |
|
3184 //MIME types |
|
3185 const CDesC8Array &mt=pf[ii]->SupportedMimeTypes(); |
|
3186 for(j=0;j<mt.Count();j++) |
|
3187 { |
|
3188 z.Copy(mt[j]); |
|
3189 if(z==z1) |
|
3190 { |
|
3191 checkMime=ETrue; |
|
3192 } |
|
3193 } |
|
3194 } |
|
3195 } |
|
3196 CleanupStack::PopAndDestroy(&controllers);//controllers |
|
3197 CleanupStack::PopAndDestroy(fs); |
|
3198 CleanupStack::PopAndDestroy(cs); |
|
3199 |
|
3200 if(checkMime) |
|
3201 { |
|
3202 findContent=KErrNone; |
|
3203 } |
|
3204 else |
|
3205 { |
|
3206 findContent=KErrNotFound; |
|
3207 } |
|
3208 IRLOG_DEBUG( "CIRNowPlayingWrapper::GetSupportedMimeTypeL - exiting" ); |
|
3209 return findContent; |
|
3210 } |
|
3211 |
|
3212 */ |
|
3213 // --------------------------------------------------------------------------- |
|
3214 // SavePreviousIndex() |
|
3215 // Sets when Listen from Isds is Done |
|
3216 // --------------------------------------------------------------------------- |
|
3217 // |
|
3218 |
|
3219 void CIRNowPlayingWrapper::SetListenFromIsdsValue(TInt aListenFromIsds ) |
|
3220 { |
|
3221 |
|
3222 IRLOG_DEBUG( "CIRNowPlayingWrapper::SetListenFromIsdsValue - Entering" ); |
|
3223 iListenFromIsds=aListenFromIsds; |
|
3224 IRLOG_DEBUG( "CIRNowPlayingWrapper::SetListenFromIsdsValue - exiting" ); |
|
3225 } |
|
3226 // --------------------------------------------------------------------------- |
|
3227 // SetWhenUserCancelsBufferingWaitBar() |
|
3228 // Sets When User Cancels Buffering |
|
3229 // --------------------------------------------------------------------------- |
|
3230 // |
|
3231 |
|
3232 void CIRNowPlayingWrapper::SetWhenUserCancelsBufferingWaitBar(TInt aDialogCanceled ) |
|
3233 { |
|
3234 |
|
3235 IRLOG_DEBUG( "CIRNowPlayingWrapper::SetWhenUserCancelsBuffering - Entering" ); |
|
3236 iDialogCanceled=aDialogCanceled; |
|
3237 IRLOG_DEBUG( "CIRNowPlayingWrapper::SetWhenUserCancelsBuffering - exiting" ); |
|
3238 } |
|
3239 // --------------------------------------------------------------------------- |
|
3240 // SetWhenUserCancelsIsdsBufferingWaitBar() |
|
3241 // Sets When User Cancels Buffering WaitBar From Isds Listen |
|
3242 // --------------------------------------------------------------------------- |
|
3243 // |
|
3244 |
|
3245 void CIRNowPlayingWrapper::SetWhenUserCancelsIsdsBufferingWaitBar(TInt aCancelFrmIsds ) |
|
3246 { |
|
3247 |
|
3248 IRLOG_DEBUG( "CIRNowPlayingWrapper::SetWhenUserCancelsIsdsBufferingWaitBar - Entering" ); |
|
3249 iCancelFrmIsds=aCancelFrmIsds; |
|
3250 IRLOG_DEBUG( "CIRNowPlayingWrapper::SetWhenUserCancelsIsdsBufferingWaitBar - exiting" ); |
|
3251 } |
|
3252 // --------------------------------------------------------------------------- |
|
3253 // GetPreviousIndex() |
|
3254 // Returns When User Cancels Isds Buffering WaitBar |
|
3255 // --------------------------------------------------------------------------- |
|
3256 // |
|
3257 |
|
3258 TBool CIRNowPlayingWrapper::GetWhenUserCancelsIsdsBufferingWaitBar( ) |
|
3259 { |
|
3260 |
|
3261 IRLOG_DEBUG( "CIRNowPlayingWrapper::GetWhenUserCancelsIsdsBufferingWaitBar - Entering" ); |
|
3262 IRLOG_DEBUG( "CIRNowPlayingWrapper::GetWhenUserCancelsIsdsBufferingWaitBar - exiting" ); |
|
3263 return iCancelFrmIsds; |
|
3264 } |
|
3265 // --------------------------------------------------------------------------- |
|
3266 // SetLaunchNowPlayingView() |
|
3267 // Sets the varible if NowPlaying is active |
|
3268 // --------------------------------------------------------------------------- |
|
3269 // |
|
3270 |
|
3271 void CIRNowPlayingWrapper::SetLaunchNowPlayingView(TBool aLaunchNowplaying ) |
|
3272 { |
|
3273 |
|
3274 IRLOG_DEBUG( "CIRNowPlayingWrapper::SetLaunchNowPlayingView - Entering" ); |
|
3275 iLaunchNowplaying=aLaunchNowplaying; |
|
3276 IRLOG_DEBUG( "CIRNowPlayingWrapper::SetLaunchNowPlayingView - exiting" ); |
|
3277 } |
|
3278 // --------------------------------------------------------------------------- |
|
3279 // GetLaunchNowPlayingView() |
|
3280 // Returns the Nowplaying Vies Active State |
|
3281 // --------------------------------------------------------------------------- |
|
3282 // |
|
3283 TBool CIRNowPlayingWrapper::GetLaunchNowPlayingView() |
|
3284 { |
|
3285 |
|
3286 IRLOG_DEBUG( "CIRNowPlayingWrapper::GetLaunchNowPlayingView - Entering" ); |
|
3287 IRLOG_DEBUG( "CIRNowPlayingWrapper::GetLaunchNowPlayingView - exiting" ); |
|
3288 return iLaunchNowplaying; |
|
3289 } |
|
3290 // --------------------------------------------------------------------------- |
|
3291 // SetFavFocus() |
|
3292 // Sets the foucs in Mainview |
|
3293 // --------------------------------------------------------------------------- |
|
3294 // |
|
3295 |
|
3296 void CIRNowPlayingWrapper::SetFavFocus(TInt aFavIndex ) |
|
3297 { |
|
3298 |
|
3299 IRLOG_DEBUG( "CIRNowPlayingWrapper::SetFavFocus - Entering" ); |
|
3300 iFavIndex=aFavIndex; |
|
3301 IRLOG_DEBUG( "CIRNowPlayingWrapper::SetFavFocus - exiting" ); |
|
3302 } |
|
3303 // --------------------------------------------------------------------------- |
|
3304 // GetFavFocus() |
|
3305 // Returns the Current Focus to set |
|
3306 // --------------------------------------------------------------------------- |
|
3307 // |
|
3308 TInt CIRNowPlayingWrapper::GetFavFocus() |
|
3309 { |
|
3310 |
|
3311 IRLOG_DEBUG( "CIRNowPlayingWrapper::GetFavFocus - Entering" ); |
|
3312 IRLOG_DEBUG( "CIRNowPlayingWrapper::GetFavFocus - exiting" ); |
|
3313 return iFavIndex; |
|
3314 } |