mmsharing/mmshui/inc/musuireceivecontroller.h
branchRCL_3
changeset 33 bc78a40cd63c
parent 0 f0cf47e981f9
equal deleted inserted replaced
32:73a1feb507fb 33:bc78a40cd63c
       
     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:  
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef MUSUIRECEIVECONTROLLER_H
       
    20 #define MUSUIRECEIVECONTROLLER_H
       
    21 
       
    22 #include "musuieventcontroller.h"
       
    23 #include "musengreceivesessionobserver.h"
       
    24 #include "musengmcesession.h"
       
    25 #include "musuiinvitationqueryobserver.h"
       
    26 #include "musunittesting.h"
       
    27 #include "musuiactivetimerobserver.h"
       
    28 
       
    29 #include <e32base.h>
       
    30 
       
    31 class MMusUiReceiveObserver;
       
    32 class CMusEngReceiveSession;
       
    33 class MMusUiReceiveObserver;
       
    34 class CMusUiActiveTimer;
       
    35 
       
    36 /**
       
    37  *
       
    38  *
       
    39  * @lib musui.exe
       
    40  */
       
    41 class CMusUiReceiveController : public CMusUiEventController,
       
    42                                 public MMusEngReceiveSessionObserver,
       
    43                                 public MMusUiInvitationQueryObserver,
       
    44                                 public MMusUiActiveTimerObserver
       
    45     {
       
    46 
       
    47 public:
       
    48 
       
    49     /**
       
    50      * Two-phased constructor. Leaves on failure.
       
    51      * @return The constructed CMusUiReceiveController object.
       
    52      */
       
    53 	static CMusUiReceiveController* NewL(
       
    54 	                        MMusUiEventObserver& aEventObserver,
       
    55                             MMusUiSharingObserver& aSharingObserver,
       
    56 	                        MMusUiReceiveObserver& aReceiveObserver,
       
    57 	                        const TRect& aRect );
       
    58 
       
    59     /**
       
    60      * Destructor.
       
    61      */
       
    62 	virtual ~CMusUiReceiveController();
       
    63 
       
    64 private:
       
    65 
       
    66     /**
       
    67      * C++ constructor.
       
    68      */
       
    69 	CMusUiReceiveController( MMusUiEventObserver& aEventObserver,
       
    70 	                         MMusUiSharingObserver& aSharingObserver,
       
    71 	                         MMusUiReceiveObserver& aReceiveObserver );
       
    72 	
       
    73     /**
       
    74      * Symbian 2nd-phase constructor.
       
    75      * @leave One of the system wide error codes
       
    76      * @param aRect Original view's rectangle, which is centered and passed
       
    77      *        for the Engine.
       
    78      */
       
    79 	void ConstructL( const TRect& aRect );
       
    80 	
       
    81 
       
    82 public:	// new functions:
       
    83     
       
    84     /**
       
    85      * Gets called by MMusEngReceiveSessionObserver's Incoming Session.
       
    86      * Function cancels the timer and displays the invitation query dialog.
       
    87      * MO Address is saved into memeber variable iOriginator.
       
    88      * @leave One of the system wide error codes
       
    89      * @param aOriginator The Address of MO.
       
    90      * @param aOriginatorIdentity The identity of MO.     
       
    91      */
       
    92     void HandleIncomingSessionL( const TDesC& aOriginator,
       
    93                                  const TDesC& iOriginatorIdentity );
       
    94                                   
       
    95     TBool ClipMutedL();
       
    96     
       
    97     TBool ClipContainsAudioL();
       
    98     
       
    99     /** 
       
   100      * Determines whether video is being played in full screen mode. 
       
   101      */
       
   102     TBool FullScreenSelected();
       
   103     
       
   104     
       
   105 public: // from CMusUiEventController
       
   106     
       
   107     /**
       
   108     * Returns a pointer to engine side session.
       
   109     */
       
   110     virtual CMusEngMceSession* EngineSession();
       
   111 
       
   112     /**
       
   113      * Implementation of the pure virtual function in MMusUiCallbackObserver.
       
   114      * Handled async. event in the MT is EMusUiAsyncInviteAccepted.
       
   115      * @param aEventId Async. event
       
   116      */
       
   117     virtual void HandleAsyncEventL( TMusUiAsyncEvent aEventId );
       
   118     
       
   119     /**
       
   120      * Implementation of the pure virtual function from CMusUiEventController
       
   121      * @return iOriginator, the address of MO
       
   122      */
       
   123     virtual const TDesC& TypedAddress() const;
       
   124 
       
   125     /**
       
   126     * Updates softkeys specific to receiving. Delegates other requests to
       
   127     * a base class.
       
   128     */
       
   129     // virtual void UpdateSoftkeyL( TInt aToolbarItem );
       
   130     
       
   131     /**
       
   132      * Handles commands generated by UI's Toolbar in the Receive View.
       
   133      * @pre iSession != NULL
       
   134      * @leave One of the system wide error codes
       
   135      * @param aCommand Identiefier of the event's command.
       
   136      */
       
   137     virtual void OfferToolbarEventL( TInt aCommand );
       
   138     
       
   139     virtual void HandleCommandL( TInt aCommand );
       
   140 
       
   141     /**
       
   142      * Implementation of the pure virtual function from CMusUiEventController
       
   143      * Deletes the Engine instance.
       
   144      */
       
   145     virtual void DeleteEngineSession();
       
   146 
       
   147 
       
   148 public: // from MMusEngReceiveSessionObserver
       
   149 
       
   150     /**
       
   151      * Called by engine when timer can be cancelled.
       
   152      */
       
   153     virtual void IncomingSessionPreNotification();
       
   154 
       
   155     /**
       
   156      * Called by the engine, when session is incoming.
       
   157      * @param aOriginator The address of MO.
       
   158      * @param aOriginatorIdentity The identity of MO.
       
   159      */
       
   160     virtual void IncomingSession( const TDesC& aOriginator, 
       
   161                                   const TDesC& iOriginatorIdentity );
       
   162 
       
   163     /**
       
   164      * Called by the engine, when current receiving session is buffering
       
   165      * received RTP.
       
   166      */
       
   167     virtual void StreamBuffering();
       
   168     
       
   169 
       
   170 public:	// from MMusEngSessionObserver
       
   171 
       
   172     /**
       
   173      * Called by the engine, when incoming session is established.
       
   174      * Dismisses the wait dialog and sets up the status pane
       
   175      */
       
   176     void SessionEstablished();
       
   177 
       
   178     /**
       
   179      * Called by the engine, when session has been terminated.
       
   180      * If connection is not established, dismisses the invitation query dialog,
       
   181      * shows an error dialog and exits.
       
   182      * Otherwise dismisses wait dialog and exits.
       
   183      */
       
   184 	void SessionTerminated();
       
   185 
       
   186     /**
       
   187      * Called by the engine, when current session has lost network connection.
       
   188      * Displays an error dialog.
       
   189      */
       
   190     void SessionConnectionLost();
       
   191     
       
   192     /**
       
   193      * Called by the engine, when an undefined exception has occurred.
       
   194      * Dismisses the wait dialog.
       
   195      */
       
   196     void SessionFailed();
       
   197     
       
   198     /**
       
   199      * Called by the engine, when we are not sending or receiving RTP.
       
   200      * Updates the icon to be Pause icon.
       
   201      */
       
   202 	void StreamIdle();
       
   203 	
       
   204     /**
       
   205      * Called by the engine, when current session state is changed to streaming
       
   206      * Dismisses the wait dialog, and updates the icon to Play icon.
       
   207      */
       
   208 	void StreamStreaming();	
       
   209 
       
   210     /**
       
   211      * Called by the engine, when time information of the session 
       
   212      * should be updated.
       
   213      * Calls Observer's UpdateSessionTime() function.
       
   214      * @param aSeconds Session time in secods to be formatted.
       
   215      */
       
   216 	void SessionTimeChanged( const TTimeIntervalSeconds& aSeconds );
       
   217 	
       
   218     /**
       
   219      * Called by the engine, when RTCP inactivity timeout has occurred.
       
   220      * Exits the application.
       
   221      */
       
   222     void InactivityTimeout();
       
   223     
       
   224 	
       
   225 public: // from MMusUiInvitationQueryObserver
       
   226 
       
   227     /**
       
   228      * Called if the user accepts the incoming invitation.
       
   229      * Calls Engine's AcceptInvitationL() function with ETrue and starts
       
   230      * to show the wait dialog async.
       
   231      * @pre iSession != NULL
       
   232      * @leave One of the system wide error codes
       
   233      */
       
   234     void InvitationAcceptedL();
       
   235     
       
   236     /*
       
   237      * Called if the user rejects the incoming invitation.
       
   238      * Calls Engine's AcceptInvitationL() with EFalse and exits the application.
       
   239      * @pre iSession != NULL
       
   240      * @leave One of the system wide error codes
       
   241      */
       
   242     void InvitationRejectedL();
       
   243 
       
   244 public: // from MMusUiActiveTimerObserver
       
   245 	
       
   246     /*
       
   247      * Called if the timer completes.
       
   248      * Calls ShutdownL() function.
       
   249      */
       
   250 	void TimerComplete( CMusUiActiveTimer* aTimer );
       
   251 
       
   252 
       
   253 protected: // from CMusUiEventController
       
   254 
       
   255     /**
       
   256     * Receive specific functionality of exit procedure
       
   257     */
       
   258     virtual void ExitProcedureL( TBool aUserAcceptance );
       
   259     
       
   260 
       
   261 private:	// new functions:
       
   262     /**
       
   263      * Changes video playing mode to the opposite. 
       
   264      * Value of iFullScreenSelected will be changed to opposite as well.
       
   265      */
       
   266     void ChangeFullScreenModeL(); 
       
   267 
       
   268     
       
   269     /**
       
   270      * Displays the wait dialog calling Observer's ShowWaitDialogL with a string
       
   271      * loaded from resources.
       
   272      * @leave One of the system wide error codes
       
   273      */
       
   274     void ShowWaitDialogL();
       
   275     
       
   276     /**
       
   277     * 
       
   278     */
       
   279     void SessionEstablishedL();
       
   280     
       
   281     
       
   282 private:
       
   283 
       
   284     /**
       
   285      * Observer interface for receiving specific callbacks
       
   286      */
       
   287 	MMusUiReceiveObserver& iReceiveObserver;
       
   288 	
       
   289     /**
       
   290      * The engine object for MT
       
   291      */
       
   292 	CMusEngReceiveSession* iSession;
       
   293 	
       
   294     /**
       
   295      * Address of the MO
       
   296      */
       
   297 	HBufC* iOriginator;
       
   298 
       
   299     /**
       
   300      * Flag indicating that video is being played in Full Screen mode
       
   301      */
       
   302     TBool iFullScreenSelected;
       
   303     /**
       
   304      * Active object timer instance
       
   305      */
       
   306 	CMusUiActiveTimer* iTimer;
       
   307 	
       
   308 	CMusEngMceSession::TDisplayOrientation iOriginalMceOrientation;
       
   309 	
       
   310 	/**
       
   311 	 * Flag indicating that the stream is paused
       
   312 	 */
       
   313 	TBool iStreamPaused;
       
   314 	
       
   315 	
       
   316     MUS_UNITTEST( UT_CMusUiReceiveController; )
       
   317 
       
   318     };
       
   319 
       
   320 #endif // MUSUIRECEIVECONTROLLER_H
       
   321 
       
   322 // end of file