|
1 /* |
|
2 * Copyright (c) 2005 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: Application's UI class. |
|
15 * Version : %version: 75.1.10 % << Don't touch! Updated by Synergy at check-out. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 #include "musuireceivecontroller.h" |
|
22 #include "musuieventobserver.h" |
|
23 #include "musuisharingobserver.h" |
|
24 #include "musuireceiveobserver.h" |
|
25 #include "musuicallbackservice.h" |
|
26 #include "musuiactivetimer.h" |
|
27 #include "musuidialogutil.h" |
|
28 #include "musuicontactutil.h" |
|
29 #include "mussettings.h" |
|
30 #include "mussettingskeys.h" |
|
31 #include "musuiresourcehandler.h" |
|
32 #include "musengreceivesession.h" |
|
33 #include "musenguriparser.h" |
|
34 #include "mussessionproperties.h" |
|
35 #include "muslogger.h" // debug logging |
|
36 #include "musuiappui.h" |
|
37 #include "musuireceiveview.h" |
|
38 #include "musuipropertywatch.h" |
|
39 #include "mussesseioninformationapi.h" |
|
40 #include "musui.hrh" |
|
41 #include <musui.rsg> |
|
42 |
|
43 #include <avkon.hrh> |
|
44 #include <aknappui.h> |
|
45 #include <StringLoader.h> |
|
46 |
|
47 using namespace MusSettingsKeys; |
|
48 using namespace NMusSessionApi; |
|
49 |
|
50 const TInt KMusMinDigitCountInValidTelNumber = 7; |
|
51 |
|
52 /* |
|
53 * Private number. |
|
54 */ |
|
55 _LIT( KPrivateNumber, "" ); |
|
56 |
|
57 // ----------------------------------------------------------------------------- |
|
58 // |
|
59 // ----------------------------------------------------------------------------- |
|
60 // |
|
61 CMusUiReceiveController* CMusUiReceiveController::NewL( |
|
62 MMusUiEventObserver& aEventObserver, |
|
63 MMusUiSharingObserver& aSharingObserver, |
|
64 MMusUiReceiveObserver& aReceiveObserver, |
|
65 const TRect& aRect ) |
|
66 { |
|
67 CMusUiReceiveController* self = new( ELeave ) CMusUiReceiveController( |
|
68 aEventObserver, |
|
69 aSharingObserver, |
|
70 aReceiveObserver ); |
|
71 CleanupStack::PushL( self ); |
|
72 self->ConstructL( aRect ); |
|
73 CleanupStack::Pop( self ); |
|
74 return self; |
|
75 } |
|
76 |
|
77 |
|
78 // ----------------------------------------------------------------------------- |
|
79 // |
|
80 // ----------------------------------------------------------------------------- |
|
81 // |
|
82 CMusUiReceiveController::~CMusUiReceiveController() |
|
83 { |
|
84 MUS_LOG( "mus: [MUSUI ] -> CMusUiReceiveController::~CMusUiReceiveController" ); |
|
85 delete iSession; |
|
86 delete iOriginator; |
|
87 delete iTimer; |
|
88 MUS_LOG( "mus: [MUSUI ] <- CMusUiReceiveController::~CMusUiReceiveController" ); |
|
89 } |
|
90 |
|
91 |
|
92 // ----------------------------------------------------------------------------- |
|
93 // |
|
94 // ----------------------------------------------------------------------------- |
|
95 // |
|
96 CMusUiReceiveController::CMusUiReceiveController( |
|
97 MMusUiEventObserver& aEventObserver, |
|
98 MMusUiSharingObserver& aSharingObserver, |
|
99 MMusUiReceiveObserver& aReceiveObserver ) |
|
100 : CMusUiEventController( aEventObserver, aSharingObserver ), |
|
101 iReceiveObserver( aReceiveObserver ) |
|
102 { |
|
103 |
|
104 } |
|
105 |
|
106 |
|
107 // ----------------------------------------------------------------------------- |
|
108 // |
|
109 // ----------------------------------------------------------------------------- |
|
110 // |
|
111 void CMusUiReceiveController::ConstructL( const TRect& aRect ) |
|
112 { |
|
113 MUS_LOG( "mus: [MUSUI ] -> CMusUiReceiveController::ConstructL" ); |
|
114 |
|
115 // construct event listener |
|
116 CMusUiEventController::ConstructL(); |
|
117 |
|
118 // construct an engine session |
|
119 iSession = CMusEngReceiveSession::NewL( aRect, *this, *this ); |
|
120 iSession->SetAudioRoutingObserver( this ); |
|
121 |
|
122 iTimer = CMusUiActiveTimer::NewL( this ); |
|
123 iTimer->After( KMusReceiveTimeout ); |
|
124 |
|
125 MUS_LOG( "mus: [MUSUI ] <- CMusUiReceiveController::ConstructL" ); |
|
126 } |
|
127 |
|
128 // ----------------------------------------------------------------------------- |
|
129 // |
|
130 // ----------------------------------------------------------------------------- |
|
131 // |
|
132 void CMusUiReceiveController::ChangeFullScreenModeL() |
|
133 { |
|
134 MUS_LOG( "mus: [MUSUI ] -> CMusUiReceiveController::ChangeFullScreenModeL" ); |
|
135 |
|
136 iFullScreenSelected = !iFullScreenSelected; |
|
137 |
|
138 if ( !MUS_NO_TOOLBAR ) |
|
139 { |
|
140 iSharingObserver.HighlightSelectedToolbarItem( EMusuiCmdToolbarFullScreen ); |
|
141 } |
|
142 |
|
143 iReceiveObserver.SetFullScreenL( iFullScreenSelected ); |
|
144 |
|
145 if ( ( iEventObserver.AppOrientation()!= CAknAppUiBase::EAppUiOrientationLandscape ) |
|
146 && iFullScreenSelected ) |
|
147 { |
|
148 if( !iEventObserver.OrientationCanBeChanged() ) |
|
149 { |
|
150 MUS_LOG( "mus: [MUSUI ] !OrientationCanBeChanged()" ); |
|
151 iSession->SetOrientationL( CMusEngMceSession::ELandscape ); |
|
152 } |
|
153 } |
|
154 else if ( ( iSession->OrientationL() != iOriginalMceOrientation ) |
|
155 && !iFullScreenSelected ) |
|
156 { |
|
157 if( !iEventObserver.OrientationCanBeChanged() ) |
|
158 { |
|
159 MUS_LOG( "mus: [MUSUI ] !OrientationCanBeChanged()" ); |
|
160 iSession->SetOrientationL( iOriginalMceOrientation ); |
|
161 } |
|
162 } |
|
163 |
|
164 MUS_LOG( "mus: [MUSUI ] <- CMusUiReceiveController::ChangeFullScreenModeL" ); |
|
165 } |
|
166 |
|
167 // ----------------------------------------------------------------------------- |
|
168 // |
|
169 // ----------------------------------------------------------------------------- |
|
170 // |
|
171 void CMusUiReceiveController::OfferToolbarEventL( TInt aCommand ) |
|
172 { |
|
173 MUS_LOG1( "mus: [MUSUI ] -> CMusUiReceiveController::OfferToolbarEventL [%d]", |
|
174 aCommand ); |
|
175 |
|
176 switch ( aCommand ) |
|
177 { |
|
178 case EMusuiCmdToolbarFullScreen: |
|
179 { |
|
180 ChangeFullScreenModeL(); |
|
181 break; |
|
182 } |
|
183 default: // Not receive specific, let the base class handle |
|
184 { |
|
185 CMusUiEventController::OfferToolbarEventL( aCommand ); |
|
186 break; |
|
187 } |
|
188 |
|
189 } |
|
190 MUS_LOG( "mus: [MUSUI ] <- CMusUiReceiveController::OfferToolbarEventL" ); |
|
191 } |
|
192 |
|
193 // ----------------------------------------------------------------------------- |
|
194 // |
|
195 // ----------------------------------------------------------------------------- |
|
196 // |
|
197 void CMusUiReceiveController::HandleCommandL( TInt aCommand ) |
|
198 { |
|
199 MUS_LOG1( "mus: [MUSUI ] -> CMusUiReceiveController::HandleCommandL: %d", |
|
200 aCommand ); |
|
201 |
|
202 switch ( aCommand ) |
|
203 { |
|
204 // Menu commands from view's HandleCommandL: |
|
205 case EMusuiCmdViewAudioNormal: |
|
206 { |
|
207 MUS_LOG( "mus: [MUSUI ] CMusUiReceiveController::ConstructL:\ |
|
208 EMusuiCmdViewAudioNormal" ); |
|
209 if ( iSession->ContainsAudioL() ) |
|
210 { |
|
211 iSession->UnmuteL(); |
|
212 } |
|
213 break; |
|
214 } |
|
215 case EMusuiCmdViewAudioMute: |
|
216 { |
|
217 MUS_LOG( "mus: [MUSUI ] CMusUiReceiveController::ConstructL:\ |
|
218 EMusuiCmdViewAudioMute" ); |
|
219 if ( iSession->ContainsAudioL() ) |
|
220 { |
|
221 iSession->MuteL(); |
|
222 } |
|
223 break; |
|
224 } |
|
225 case EMusuiCmdToolbarFullScreen: |
|
226 { |
|
227 OfferToolbarEventL( EMusuiCmdToolbarFullScreen ); |
|
228 break; |
|
229 } |
|
230 case EMusuiCmdViewFullScreen: |
|
231 { |
|
232 ChangeFullScreenModeL(); |
|
233 break; |
|
234 } |
|
235 default: |
|
236 { |
|
237 // Try more general handling |
|
238 CMusUiEventController::HandleCommandL( aCommand ); |
|
239 break; |
|
240 } |
|
241 } |
|
242 MUS_LOG( "mus: [MUSUI ] <- CMusUiReceiveController::HandleCommandL" ); |
|
243 } |
|
244 |
|
245 |
|
246 // ----------------------------------------------------------------------------- |
|
247 // |
|
248 // ----------------------------------------------------------------------------- |
|
249 // |
|
250 void CMusUiReceiveController::HandleIncomingSessionL( |
|
251 const TDesC& aOriginator, |
|
252 const TDesC& aOriginatorIdentity ) |
|
253 { |
|
254 MUS_LOG( "mus: [MUSUI ] -> CMusUiReceiveController::HandleIncomingSessionL" ) |
|
255 |
|
256 delete iOriginator; |
|
257 iOriginator = NULL; |
|
258 TInt privacyStatus(0); |
|
259 |
|
260 |
|
261 MUS_LOG( "mus: [MUSUI ] Check private number" ) |
|
262 TRAPD( errorPrivacyStatus, privacyStatus = |
|
263 CMusUiPropertyWatch::ReadIntPropertyL( NMusSessionApi::KPrivacyStatus ) ); |
|
264 if ( errorPrivacyStatus != KErrNone ) |
|
265 { |
|
266 MUS_LOG1( "mus: [MUSUI ] ReadIntPropertyL leave code: %d", errorPrivacyStatus ) |
|
267 HandleError( errorPrivacyStatus ); |
|
268 } |
|
269 |
|
270 if ( privacyStatus == 1 ) |
|
271 { |
|
272 MUS_LOG( "mus: [MUSUI ] Call is from private number" ) |
|
273 iOriginator = KPrivateNumber().AllocL(); |
|
274 } |
|
275 else if( iOperatorSpecificFunctionality ) |
|
276 { |
|
277 iOriginator = aOriginatorIdentity.AllocL(); |
|
278 } |
|
279 else |
|
280 { |
|
281 iOriginator = aOriginator.AllocL(); |
|
282 } |
|
283 |
|
284 // Cancel the 10 seconds timer: |
|
285 iTimer->Cancel(); |
|
286 |
|
287 // Display the query dialog: |
|
288 |
|
289 if ( privacyStatus == 1 ) |
|
290 { |
|
291 iReceiveObserver.ShowInvitationQueryL( *iOriginator ); |
|
292 } |
|
293 else if ( iOperatorSpecificFunctionality && aOriginatorIdentity.Length() != 0 ) |
|
294 { |
|
295 // We compare last seven digits, since that is the minimum amount |
|
296 // that can make up a valid telephone number. |
|
297 MUS_LOG_TDESC( "mus: [MUSUI ] Right7 of MusTelNumberValue(): ", |
|
298 MusTelNumberValue().Right( KMusMinDigitCountInValidTelNumber ) ) |
|
299 MUS_LOG_TDESC( "mus: [MUSUI ] Right7 of aOriginatorIdentity: ", |
|
300 aOriginatorIdentity.Right( KMusMinDigitCountInValidTelNumber ) ) |
|
301 MUS_LOG_TDESC( "mus: [MUSUI ] MusContactName: ", MusContactName() ) |
|
302 |
|
303 if ( !( MusTelNumberValue().Length() >= |
|
304 KMusMinDigitCountInValidTelNumber && |
|
305 aOriginatorIdentity.Length() >= |
|
306 KMusMinDigitCountInValidTelNumber && |
|
307 MusTelNumberValue().Right( KMusMinDigitCountInValidTelNumber ) == |
|
308 aOriginatorIdentity.Right( KMusMinDigitCountInValidTelNumber ) && |
|
309 MusContactName().Length() > 0 ) ) |
|
310 { |
|
311 // In some very rare scenario a valid session may come from MSISDN |
|
312 // that is not the same as the one received from manager. To avoid |
|
313 // showing of wrong MSISDN, we replace phone number with one |
|
314 // received from P-Asserted-Identity header. Since in this scenario |
|
315 // we cannot be sure about contact name either, we replace it with |
|
316 // phone number. Replacing of contact name must happen also when we |
|
317 // have no name for contact. |
|
318 delete iTelNumber; |
|
319 iTelNumber = NULL; |
|
320 iTelNumber = aOriginatorIdentity.AllocL(); |
|
321 |
|
322 delete iContactName; |
|
323 iContactName = NULL; |
|
324 iContactName = aOriginatorIdentity.AllocL(); |
|
325 } |
|
326 |
|
327 iReceiveObserver.ShowInvitationQueryL( MusContactName() ); |
|
328 |
|
329 } |
|
330 else |
|
331 { |
|
332 if( MusUiContactUtil::CheckPbContactForVSAddressesL( |
|
333 *( iEventObserver.EikonEnv() ), *iOriginator, iContactId ) ) |
|
334 { |
|
335 if ( MusContactName().Length() < 1 ) |
|
336 { // originator is defined in Contacts but the name is empty |
|
337 iReceiveObserver.ShowInvitationQueryL( *iOriginator ); |
|
338 } |
|
339 else |
|
340 { |
|
341 iReceiveObserver.ShowInvitationQueryL( MusContactName() ); |
|
342 } |
|
343 } |
|
344 else |
|
345 { |
|
346 iReceiveObserver.ShowInvitationQueryL( *iOriginator ); |
|
347 } |
|
348 } |
|
349 |
|
350 MUS_LOG( "mus: [MUSUI ] <- CMusUiReceiveController::HandleIncomingSessionL" ) |
|
351 } |
|
352 |
|
353 |
|
354 // ----------------------------------------------------------------------------- |
|
355 // |
|
356 // ----------------------------------------------------------------------------- |
|
357 // |
|
358 TBool CMusUiReceiveController::ClipMutedL() |
|
359 { |
|
360 return iSession->IsMutedL(); |
|
361 } |
|
362 |
|
363 |
|
364 // ----------------------------------------------------------------------------- |
|
365 // |
|
366 // ----------------------------------------------------------------------------- |
|
367 // |
|
368 TBool CMusUiReceiveController::ClipContainsAudioL() |
|
369 { |
|
370 if ( !ConnectionInitialized() ) |
|
371 { |
|
372 return EFalse; // We cannot be sure yet |
|
373 } |
|
374 |
|
375 return iSession->ContainsAudioL(); |
|
376 } |
|
377 |
|
378 |
|
379 // ----------------------------------------------------------------------------- |
|
380 // |
|
381 // ----------------------------------------------------------------------------- |
|
382 // |
|
383 CMusEngMceSession* CMusUiReceiveController::EngineSession() |
|
384 { |
|
385 return iSession; // CMusEngReceiveSession is CMusEngMceSession |
|
386 } |
|
387 |
|
388 |
|
389 // ----------------------------------------------------------------------------- |
|
390 // Virtual function from CMusUiEventController |
|
391 // ----------------------------------------------------------------------------- |
|
392 // |
|
393 void CMusUiReceiveController::HandleAsyncEventL( TMusUiAsyncEvent aEventId ) |
|
394 { |
|
395 MUS_LOG( "mus: [MUSUI ] -> CMusUiReceiveController::HandleAsyncEventL" ); |
|
396 switch ( aEventId ) |
|
397 { |
|
398 case EMusUiAsyncInviteAccepted: |
|
399 { |
|
400 ShowWaitDialogL(); |
|
401 break; |
|
402 } |
|
403 default: |
|
404 { |
|
405 // Not receive specific, let the base class handle |
|
406 CMusUiEventController::HandleAsyncEventL( aEventId ); |
|
407 } |
|
408 } |
|
409 MUS_LOG( "mus: [MUSUI ] <- CMusUiReceiveController::HandleAsyncEventL" ); |
|
410 } |
|
411 |
|
412 |
|
413 // ----------------------------------------------------------------------------- |
|
414 // Virtual function from CMusUiEventController |
|
415 // ----------------------------------------------------------------------------- |
|
416 // |
|
417 const TDesC& CMusUiReceiveController::TypedAddress() const |
|
418 { |
|
419 return *iOriginator; |
|
420 } |
|
421 |
|
422 |
|
423 // ----------------------------------------------------------------------------- |
|
424 // Virtual function from CMusUiEventController |
|
425 // ----------------------------------------------------------------------------- |
|
426 // |
|
427 void CMusUiReceiveController::DeleteEngineSession() |
|
428 { |
|
429 MUS_LOG( "mus: [MUSUI ] -> CMusUiReceiveController::DeleteEngineSession" ); |
|
430 delete iSession; |
|
431 iSession = NULL; |
|
432 MUS_LOG( "mus: [MUSUI ] <- CMusUiReceiveController::DeleteEngineSession" ); |
|
433 } |
|
434 |
|
435 |
|
436 // ----------------------------------------------------------------------------- |
|
437 // |
|
438 // ----------------------------------------------------------------------------- |
|
439 // |
|
440 TBool CMusUiReceiveController::FullScreenSelected() |
|
441 { |
|
442 return iFullScreenSelected; |
|
443 } |
|
444 |
|
445 |
|
446 // ----------------------------------------------------------------------------- |
|
447 // From MMusEngReceiveSessionObserver |
|
448 // ----------------------------------------------------------------------------- |
|
449 // |
|
450 void CMusUiReceiveController::IncomingSessionPreNotification() |
|
451 { |
|
452 MUS_LOG( "mus: [MUSUI ] -> CMusUiReceiveController::IncomingSessionPreNotification" ); |
|
453 iTimer->Cancel(); |
|
454 MUS_LOG( "mus: [MUSUI ] <- CMusUiReceiveController::IncomingSessionPreNotification" ); |
|
455 } |
|
456 |
|
457 |
|
458 // ----------------------------------------------------------------------------- |
|
459 // From MMusEngReceiveSessionObserver |
|
460 // ----------------------------------------------------------------------------- |
|
461 // |
|
462 void CMusUiReceiveController::IncomingSession( const TDesC& aOriginator, |
|
463 const TDesC& aOriginatorIdentity ) |
|
464 { |
|
465 MUS_LOG( "mus: [MUSUI ] -> CMusUiReceiveController::IncomingSession" ); |
|
466 TRAPD( err, HandleIncomingSessionL( aOriginator, aOriginatorIdentity ) ); |
|
467 if ( err != KErrNone ) |
|
468 { |
|
469 iEventObserver.HandleError( err ); |
|
470 } |
|
471 else |
|
472 { |
|
473 SetConnectionInitialized( ETrue ); |
|
474 } |
|
475 MUS_LOG( "mus: [MUSUI ] <- CMusUiReceiveController::IncomingSession" ); |
|
476 } |
|
477 |
|
478 |
|
479 // ----------------------------------------------------------------------------- |
|
480 // From MMusEngReceiveSessionObserver |
|
481 // ----------------------------------------------------------------------------- |
|
482 // |
|
483 void CMusUiReceiveController::StreamBuffering() |
|
484 { |
|
485 MUS_LOG( "mus: [MUSUI ] -> CMusUiReceiveController::StreamBuffering" ); |
|
486 if ( iStreamPaused ) |
|
487 { |
|
488 MUS_LOG( "mus: [MUSUI ] Stream was paused, not show buffering state" ); |
|
489 } |
|
490 else |
|
491 { |
|
492 TRAPD( err, iEventObserver.ShowNaviPaneIconL( EMusUiNaviIconWaitAnim ) ); |
|
493 if ( err != KErrNone ) |
|
494 { |
|
495 iEventObserver.HandleError( err ); |
|
496 } |
|
497 } |
|
498 |
|
499 MUS_LOG( "mus: [MUSUI ] -> CMusUiReceiveController::StreamBuffering" ); |
|
500 } |
|
501 |
|
502 |
|
503 // ----------------------------------------------------------------------------- |
|
504 // From MMusEngSessionObserver |
|
505 // ----------------------------------------------------------------------------- |
|
506 // |
|
507 void CMusUiReceiveController::SessionEstablished() |
|
508 { |
|
509 MUS_LOG( "mus: [MUSUI ] -> CMusUiReceiveController::SessionEstablished" ); |
|
510 |
|
511 // Common handling first |
|
512 CMusUiEventController::SessionEstablished(); |
|
513 |
|
514 TRAPD( error, SessionEstablishedL() ) |
|
515 |
|
516 if ( error != KErrNone ) |
|
517 { |
|
518 iEventObserver.HandleError( error ); |
|
519 } |
|
520 |
|
521 MUS_LOG( "mus: [MUSUI ] <- CMusUiReceiveController::SessionEstablished" ); |
|
522 } |
|
523 |
|
524 |
|
525 // ----------------------------------------------------------------------------- |
|
526 // From MMusEngSessionObserver |
|
527 // ----------------------------------------------------------------------------- |
|
528 // |
|
529 void CMusUiReceiveController::SessionTerminated() |
|
530 { |
|
531 MUS_LOG( "mus: [MUSUI ] -> CMusUiReceiveController::SessionTerminated" ); |
|
532 if ( !ConnectionEstablished() ) |
|
533 { |
|
534 iReceiveObserver.DismissInvitationQuery( ETrue ); |
|
535 TRAP_IGNORE( MusUiDialogUtil::ShowInformationDialogL( |
|
536 R_MUS_LIVE_SHARING_VIEW_NOTE_INVITATION_CANCELLED ) ) |
|
537 iEventObserver.HandleExit(); |
|
538 } |
|
539 else |
|
540 { |
|
541 TRAP_IGNORE( iSharingObserver.DismissWaitDialogL() ); |
|
542 |
|
543 TRAP_IGNORE( iCallbackService->AsyncEventL( EMusUiAsyncHandleExit ) ); |
|
544 |
|
545 } |
|
546 MUS_LOG( "mus: [MUSUI ] <- CMusUiReceiveController::SessionTerminated" ); |
|
547 } |
|
548 |
|
549 |
|
550 // ----------------------------------------------------------------------------- |
|
551 // From MMusEngSessionObserver |
|
552 // ----------------------------------------------------------------------------- |
|
553 // |
|
554 void CMusUiReceiveController::SessionConnectionLost() |
|
555 { |
|
556 MUS_LOG( "mus: [MUSUI ] -> CMusUiReceiveController::SessionConnectionLost" ); |
|
557 TRAPD( err, |
|
558 iSharingObserver.DismissWaitDialogL(); |
|
559 MusUiDialogUtil::ShowGlobalErrorDialogL( |
|
560 R_MUS_LIVE_SHARING_VIEW_NOTE_CONNECTION_LOST ) ); |
|
561 if ( err != KErrNone ) |
|
562 { |
|
563 iEventObserver.HandleError( err ); |
|
564 } |
|
565 |
|
566 TRAP_IGNORE( iCallbackService->AsyncEventL( EMusUiAsyncHandleExit ) ); |
|
567 |
|
568 MUS_LOG( "mus: [MUSUI ] <- CMusUiReceiveController::SessionConnectionLost" ); |
|
569 } |
|
570 |
|
571 |
|
572 // ----------------------------------------------------------------------------- |
|
573 // From MMusEngSessionObserver |
|
574 // ----------------------------------------------------------------------------- |
|
575 // |
|
576 void CMusUiReceiveController::SessionFailed() |
|
577 { |
|
578 MUS_LOG( "mus: [MUSUI ] -> CMusUiReceiveController::SessionFailed" ); |
|
579 TRAPD( error, iSharingObserver.DismissWaitDialogL() ); |
|
580 if ( error != KErrNone ) |
|
581 { |
|
582 iEventObserver.HandleError( error ); |
|
583 } |
|
584 MUS_LOG( "mus: [MUSUI ] <- CMusUiReceiveController::SessionFailed" ); |
|
585 } |
|
586 |
|
587 |
|
588 // ----------------------------------------------------------------------------- |
|
589 // From MMusEngSessionObserver |
|
590 // ----------------------------------------------------------------------------- |
|
591 // |
|
592 void CMusUiReceiveController::StreamIdle() |
|
593 { |
|
594 MUS_LOG( "mus: [MUSUI ] -> CMusUiReceiveController::StreamIdle" ); |
|
595 iStreamPaused = ETrue; |
|
596 TRAPD( err, iEventObserver.ShowNaviPaneIconL( EMusUiNaviIconPause ) ); |
|
597 if ( err != KErrNone ) |
|
598 { |
|
599 iEventObserver.HandleError( err ); |
|
600 } |
|
601 MUS_LOG( "mus: [MUSUI ] <- CMusUiReceiveController::StreamIdle" ); |
|
602 } |
|
603 |
|
604 |
|
605 // ----------------------------------------------------------------------------- |
|
606 // From MMusEngSessionObserver |
|
607 // ----------------------------------------------------------------------------- |
|
608 // |
|
609 void CMusUiReceiveController::StreamStreaming() |
|
610 { |
|
611 MUS_LOG( "mus: [MUSUI ] -> CMusUiReceiveController::StreamStreaming" ); |
|
612 |
|
613 if ( ConnectionEstablished() ) |
|
614 { |
|
615 TRAP_IGNORE( iSharingObserver.DismissWaitDialogL() ) |
|
616 TRAPD( err, iEventObserver.ShowNaviPaneIconL( EMusUiNaviIconPlay ) ) |
|
617 |
|
618 if ( err != KErrNone ) |
|
619 { |
|
620 iEventObserver.HandleError( err ); |
|
621 } |
|
622 iStreamPaused = EFalse; |
|
623 } |
|
624 |
|
625 MUS_LOG( "mus: [MUSUI ] <- CMusUiReceiveController::StreamStreaming" ); |
|
626 } |
|
627 |
|
628 |
|
629 // ----------------------------------------------------------------------------- |
|
630 // From MMusEngSessionObserver |
|
631 // ----------------------------------------------------------------------------- |
|
632 // |
|
633 void CMusUiReceiveController::SessionTimeChanged( |
|
634 const TTimeIntervalSeconds& aSeconds ) |
|
635 { |
|
636 if ( aSeconds.Int() > -1 ) |
|
637 { |
|
638 iSharingObserver.UpdateSessionTime( SessionTimeFormatted( aSeconds ) ); |
|
639 } |
|
640 } |
|
641 |
|
642 |
|
643 // ----------------------------------------------------------------------------- |
|
644 // From MMusEngSessionObserver |
|
645 // ----------------------------------------------------------------------------- |
|
646 // |
|
647 void CMusUiReceiveController::InactivityTimeout() |
|
648 { |
|
649 MUS_LOG( "mus: [MUSUI ] -> CMusUiReceiveController::InactivityTimeout" ); |
|
650 TRAP_IGNORE( iSharingObserver.DismissWaitDialogL(); |
|
651 MusUiDialogUtil::ShowGlobalErrorDialogL( |
|
652 R_MUS_LIVE_SHARING_VIEW_NOTE_SERVICE_N_A ) ); |
|
653 |
|
654 TRAP_IGNORE( iCallbackService->AsyncEventL( EMusUiAsyncHandleExit ) ); |
|
655 |
|
656 MUS_LOG( "mus: [MUSUI ] <- CMusUiReceiveController::InactivityTimeout" ); |
|
657 } |
|
658 |
|
659 |
|
660 // ----------------------------------------------------------------------------- |
|
661 // From MMusUiInvitationQueryObserver: Invitation accepted by the user |
|
662 // ----------------------------------------------------------------------------- |
|
663 // |
|
664 void CMusUiReceiveController::InvitationAcceptedL() |
|
665 { |
|
666 MUS_LOG( "mus: [MUSUI ] -> CMusUiReceiveController::InvitationAcceptedL" ); |
|
667 __ASSERT_ALWAYS( iSession, User::Leave( KErrNotReady ) ); |
|
668 |
|
669 // Enable loud speaker already before answering but disable it immediately |
|
670 // if accepting fails for some reason |
|
671 if ( iSession->AudioRoutingCanBeChanged() ) |
|
672 { |
|
673 iSession->EnableLoudspeakerL( ELoudspeakerEnabled, ETrue ); |
|
674 } |
|
675 |
|
676 TRAPD( err, iSession->AcceptInvitationL( ETrue ) ); |
|
677 if ( err ) |
|
678 { |
|
679 if ( iSession->AudioRoutingCanBeChanged() ) |
|
680 { |
|
681 iSession->EnableLoudspeakerL( ELoudspeakerDisabled, ETrue ); |
|
682 } |
|
683 User::Leave( err ); |
|
684 } |
|
685 |
|
686 iCallbackService->AsyncEventL( EMusUiAsyncInviteAccepted ); |
|
687 |
|
688 |
|
689 MUS_LOG( "mus: [MUSUI ] <- CMusUiReceiveController::InvitationAcceptedL" ); |
|
690 } |
|
691 |
|
692 |
|
693 // ----------------------------------------------------------------------------- |
|
694 // From MMusUiInvitationQueryObserver: Invitation rejected by the user |
|
695 // ----------------------------------------------------------------------------- |
|
696 // |
|
697 void CMusUiReceiveController::InvitationRejectedL() |
|
698 { |
|
699 MUS_LOG( "mus: [MUSUI ] -> CMusUiReceiveController::InvitationRejectedL" ); |
|
700 __ASSERT_ALWAYS( iSession, User::Leave( KErrNotReady ) ); |
|
701 iSession->AcceptInvitationL( EFalse ); |
|
702 HandleExitL(); |
|
703 MUS_LOG( "mus: [MUSUI ] <- CMusUiReceiveController::InvitationRejectedL" ); |
|
704 } |
|
705 |
|
706 |
|
707 // ----------------------------------------------------------------------------- |
|
708 // From MMusUiActiveTimerObserver |
|
709 // ----------------------------------------------------------------------------- |
|
710 // |
|
711 void CMusUiReceiveController::TimerComplete( CMusUiActiveTimer* /*aTimer*/ ) |
|
712 { |
|
713 MUS_LOG( "mus: [MUSUI ] -> CMusUiReceiveController::TimerComplete" ); |
|
714 iEventObserver.HandleExit(); |
|
715 MUS_LOG( "mus: [MUSUI ] <- CMusUiReceiveController::TimerComplete" ); |
|
716 } |
|
717 |
|
718 |
|
719 // ----------------------------------------------------------------------------- |
|
720 // |
|
721 // ----------------------------------------------------------------------------- |
|
722 // |
|
723 void CMusUiReceiveController::ExitProcedureL( TBool aUserAcceptance ) |
|
724 { |
|
725 |
|
726 MUS_LOG( "mus: [MUSUI ] -> CMusUiReceiveController::ExitProcedureL" ); |
|
727 |
|
728 switch ( iShutdownState ) |
|
729 { |
|
730 case EMusUiShutdownVideoSaved: |
|
731 { |
|
732 MUS_LOG( "mus: [MUSUI ] ExitProcedureL: EMusuiShutdownVideoSaved" ); |
|
733 |
|
734 // Check if our address is valid sip or tel uri. If not, there is no |
|
735 // reason to query user about permission to save it to contacts. |
|
736 |
|
737 TInt error = KErrNotFound; |
|
738 if ( iOriginator ) |
|
739 { |
|
740 TMusEngUriParser parser( *iOriginator ); |
|
741 TRAP( error, parser.ParseUriL() ) |
|
742 } |
|
743 |
|
744 // Save Address to Contacts query if contact found and |
|
745 // there is no address in contacts |
|
746 // and if is the standard variant. |
|
747 if ( !iOperatorSpecificFunctionality && iContactId > 0 && |
|
748 !MusUiContactUtil::ShareViewFieldExistsL( |
|
749 *( iEventObserver.EikonEnv() ), iContactId ) && |
|
750 error == KErrNone ) |
|
751 { |
|
752 iShutdownState = EMusUiShutdownContactSavingQueried; |
|
753 iEventObserver.SetToolbarVisibility( EFalse ); |
|
754 SaveContactQueryL(); |
|
755 } |
|
756 else |
|
757 { |
|
758 // Nothing receive specific, let the base class handle |
|
759 CMusUiEventController::ExitProcedureL( aUserAcceptance ); |
|
760 } |
|
761 break; |
|
762 } |
|
763 |
|
764 default: |
|
765 { |
|
766 // Nothing receive specific, let the base class handle |
|
767 CMusUiEventController::ExitProcedureL( aUserAcceptance ); |
|
768 break; |
|
769 } |
|
770 } |
|
771 |
|
772 MUS_LOG( "mus: [MUSUI ] <- CMusUiReceiveController::ExitProcedureL" ); |
|
773 } |
|
774 |
|
775 |
|
776 // ----------------------------------------------------------------------------- |
|
777 // |
|
778 // ----------------------------------------------------------------------------- |
|
779 // |
|
780 void CMusUiReceiveController::ShowWaitDialogL() |
|
781 { |
|
782 MUS_LOG( "mus: [MUSUI ] -> CMusUiReceiveController::ShowWaitDialogL" ); |
|
783 |
|
784 delete iDialogPrompt; |
|
785 iDialogPrompt = NULL; |
|
786 |
|
787 iDialogPrompt = StringLoader::LoadL( |
|
788 R_MUS_RECEIVE_VIEW_WAITING_FOR_STREAM, |
|
789 ( MusContactName().Length() > 0 ) ? |
|
790 MusContactName() : |
|
791 *iOriginator ); |
|
792 |
|
793 if ( !iSharingObserver.ShowWaitDialogL( |
|
794 *iDialogPrompt, |
|
795 KMusInviteExpireTimeout, |
|
796 R_MUS_LIVE_SHARING_VIEW_NOTE_TIMEOUT_EXPIRED ) ) |
|
797 { |
|
798 HandleExitL(); |
|
799 } |
|
800 |
|
801 MUS_LOG( "mus: [MUSUI ] <- CMusUiReceiveController::ShowWaitDialogL" ); |
|
802 } |
|
803 |
|
804 |
|
805 // ----------------------------------------------------------------------------- |
|
806 // From MMusEngSessionObserver |
|
807 // ----------------------------------------------------------------------------- |
|
808 // |
|
809 void CMusUiReceiveController::SessionEstablishedL() |
|
810 { |
|
811 MUS_LOG( "mus: [MUSUI ] -> CMusUiReceiveController::SessionEstablishedL" ); |
|
812 |
|
813 iConnectionEstablished = ETrue; |
|
814 iSharingObserver.DismissWaitDialogL(); |
|
815 |
|
816 if ( iCallbackService->CurrentEvent() == EMusUiAsyncInviteAccepted ) |
|
817 { |
|
818 iCallbackService->Cancel(); |
|
819 } |
|
820 |
|
821 // Orientation for video player |
|
822 iResourceHandler->RequestVideoPlayerL( ETrue ); |
|
823 |
|
824 iOriginalMceOrientation = iSession->OrientationL(); |
|
825 |
|
826 // set the mce orientation if different than videoplayer orientation |
|
827 CAknAppUiBase::TAppUiOrientation currentOrientation = |
|
828 STATIC_CAST(CMusUiReceiveView&,iReceiveObserver).MusAppUi()->Orientation(); |
|
829 |
|
830 if( (iOriginalMceOrientation == CMusEngMceSession::EPortrait && |
|
831 currentOrientation== CAknAppUiBase::EAppUiOrientationPortrait ) || |
|
832 (iOriginalMceOrientation == CMusEngMceSession::ELandscape && |
|
833 currentOrientation== CAknAppUiBase::EAppUiOrientationLandscape )) |
|
834 { |
|
835 MUS_LOG( "mus: [MUSUI ] -> MCE & Videoplayer orientation is same" ); |
|
836 // Both MCE and Videoplayer has same orientation. |
|
837 } |
|
838 else |
|
839 { |
|
840 if(currentOrientation == CAknAppUiBase::EAppUiOrientationPortrait) |
|
841 { |
|
842 MUS_LOG( "mus: [MUSUI ] -> Setting MCE Orientation to Portrait" ); |
|
843 iSession->SetOrientationL(CMusEngMceSession::EPortrait); |
|
844 } |
|
845 else if(currentOrientation == CAknAppUiBase::EAppUiOrientationLandscape) |
|
846 { |
|
847 MUS_LOG( "mus: [MUSUI ] -> Setting MCE Orientation to Landscape" ); |
|
848 iSession->SetOrientationL(CMusEngMceSession::ELandscape); |
|
849 } |
|
850 else |
|
851 { |
|
852 MUS_LOG( "mus: [MUSUI ] -> Undefined Orientation. " ); |
|
853 } |
|
854 } |
|
855 |
|
856 if ( iForeground ) |
|
857 { |
|
858 EnableDisplayL( ETrue ); |
|
859 iEventObserver.SetToolbarVisibility( ETrue ); |
|
860 } |
|
861 |
|
862 MUS_LOG( "mus: [MUSUI ] <- CMusUiReceiveController::SessionEstablishedL" ); |
|
863 } |
|
864 |
|
865 |
|
866 // End of file |
|
867 |