mmsharing/livecommsui/lcui/tsrc/ipvtengine/inc/musengmcesession.h
changeset 22 496ad160a278
child 34 01f0bb65bcf1
equal deleted inserted replaced
15:ccd8e69b5392 22:496ad160a278
       
     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 MUSENGMCESESSION_H
       
    20 #define MUSENGMCESESSION_H
       
    21 
       
    22 // USER
       
    23 #include "musengcamerahandler.h"
       
    24 #include "musengdisplayhandler.h"
       
    25 #include "lcsession.h"
       
    26 #include "lcaudiocontrol.h"
       
    27 #include "svptimerobserver.h"
       
    28 
       
    29 #include <e32base.h>
       
    30 
       
    31 
       
    32 // FORWARD DECLARATIONS
       
    33 class CContactTextField;
       
    34 class CPbkContactItem;
       
    35 class CPbkContactEngine;
       
    36 class MLcSessionObserver;
       
    37 class CMusEngLiveVideoPlayer;
       
    38 class CMusEngRemoteVideoPlayer;
       
    39 class CSVPTimer;
       
    40 class CMccScreen;
       
    41 
       
    42 
       
    43 // CONSTANTS
       
    44 
       
    45 _LIT8( KMusEngAcceptContactHeader, 
       
    46        "Accept-Contact: *;+g.3gpp.cs-voice; explicit" );
       
    47 _LIT8( KMusAcceptHeader, 
       
    48        "Accept: application/sdp" );
       
    49 _LIT8( KMusEngSessionSdpLineXApplication, "a=X-application:com.nokia.rtvs\r\n" );
       
    50 _LIT8( KMusEngSessionSdpLineApplication , "a=application:com.gsma.rts\r\n" );
       
    51 _LIT8( KMusEngSessionSdpLineType, "a=type:videolive\r\n" );
       
    52 _LIT8( KMusEngSessionSdpLineBandwidthLine  , "b=AS:" );
       
    53 _LIT8( KMusEngSessionSdpLineBandwidthField  , "b=AS:85\r\n" );
       
    54 _LIT8( KMusEngSessionSdpLineTiasLine  , "b=TIAS:" );
       
    55 _LIT8( KMusPPreferredIdentity, "P-Preferred-Identity" );
       
    56 _LIT8( KMusEngNewLine  , "\r\n" );
       
    57 
       
    58 const TInt KMusTiasMultiplier = 1000;
       
    59 const TUint8 KMusEngRtpKeepAliveTimer = 5;
       
    60 const TUint8 KMusEngKeepAlivePayloadTypeVideoH263 = 96;
       
    61 const TUint8 KMusEngKeepAlivePayloadTypeAudio = 97;
       
    62 const TUint8 KMusEngKeepAlivePayloadTypeVideoAvc = 98;
       
    63 
       
    64 // CLASS DECLARATION
       
    65 
       
    66 /**
       
    67 * Base class for Multimedia Sharing Engine MCE sessions, inherited by
       
    68 * CMusEngLiveSession CMusEngClipSession and CMusEngReceiveSession.
       
    69 *
       
    70 * CMusEngMceSession encapsulates CMCESession and simplifies use of
       
    71 * MCE Sessions to user interface. Also splits observers messy events
       
    72 * to simplified function calls.
       
    73 *
       
    74 * @lib musengine.lib
       
    75 */
       
    76 class CMusEngMceSession : public CBase,
       
    77                           public MLcSession,
       
    78                           public MLcAudioControl,
       
    79 			  public MMusEngDisplayHandler,
       
    80 			  public MSVPTimerObserver
       
    81     {
       
    82     public:
       
    83 
       
    84         /**
       
    85         * Destructor
       
    86         */
       
    87         ~CMusEngMceSession();
       
    88 
       
    89         void SetRemoteL( const TDesC& aRemote );
       
    90 	      void ToggleCameraL();
       
    91 	      void PlayCameraL();
       
    92 	      void PauseCameraL();
       
    93         void InformUiProviderAboutReceivingStart();
       
    94 
       
    95     public: //  from MSVPTimerObserver
       
    96 
       
    97         virtual void TimedOut( TInt aTimerId );       
       
    98 
       
    99         
       
   100     public: //  from MMusEngDisplayHandler
       
   101 
       
   102         /**
       
   103         * Returns currently assigned drawing area
       
   104         *
       
   105         * @return TRect This session drawing area rectangle
       
   106         */
       
   107         TRect Rect() const;
       
   108         
       
   109         /**
       
   110         * Sets new drawing area
       
   111         *
       
   112         * @param TRect This session new drawing area rectangle
       
   113         */
       
   114         void SetRectL( const TRect& aRect );
       
   115         
       
   116         /**
       
   117         * Sets secondary rect (e.g. viewfinder in twoway session)
       
   118         * @param TRect This session new secondary drawing area rectangle
       
   119         */
       
   120         void SetSecondaryRectL( const TRect& aSecondaryRect );
       
   121         
       
   122         /**
       
   123         * Gets secondary rect.
       
   124         * @return TRect This session secondary drawing area rectangle
       
   125         */
       
   126         virtual TRect SecondaryRect() const;
       
   127             
       
   128         /**
       
   129         * Returns current display orientation.
       
   130         *
       
   131         * @pre Session is ongoing
       
   132         * @return Current display orientation 
       
   133         * @leave KErrNotReady if precondition is not fullfilled
       
   134         */
       
   135         TDisplayOrientation OrientationL();
       
   136         
       
   137         /**
       
   138         * Sets display orientation.
       
   139         *
       
   140         * @pre Session is ongoing
       
   141         * @return Sets display orientation 
       
   142         * @leave KErrNotReady if precondition is not fullfilled
       
   143         */
       
   144         void SetOrientationL( TDisplayOrientation aOrientation );
       
   145 
       
   146         /**
       
   147         * Permission to draw on screen device.
       
   148         * 
       
   149         * @pre Session is ongoing
       
   150         */
       
   151         void EnableDisplayL( TBool aEnable );
       
   152         
       
   153         /**
       
   154         * Implements virtual from MMusEngDisplayHandler
       
   155         *
       
   156         * @pre Session is ongoing
       
   157         */
       
   158         TBool IsDisplayEnabled();
       
   159         
       
   160         /**
       
   161         * Implements virtual from MMusEngDisplayHandler
       
   162         *
       
   163         * @pre Session is ongoing
       
   164         */
       
   165         TBool IsDisplayActive();
       
   166 
       
   167         
       
   168     public: // From MMusEngAudioRoutingObserver
       
   169         
       
   170         void AudioRoutingChanged();        
       
   171         
       
   172         
       
   173     public: // From MLcSession
       
   174         
       
   175         virtual TLcSessionState LcSessionState() const;
       
   176         
       
   177         void SetLcSessionObserver( MLcSessionObserver* aObserver );
       
   178 
       
   179         void SetLcUiProvider( MLcUiProvider* aUiProvider );        
       
   180         
       
   181         virtual MLcVideoPlayer* RemoteVideoPlayer();
       
   182     
       
   183         virtual MLcVideoPlayer* LocalVideoPlayer();       
       
   184        
       
   185         virtual const TDesC& LocalDisplayName();
       
   186     
       
   187         virtual const TDesC& RemoteDisplayName();
       
   188 
       
   189         TInt SetParameter( TInt aId, TInt aValue );
       
   190 
       
   191         TInt ParameterValue( TInt aId );    
       
   192         
       
   193         TBool IsBackgroundStartup();
       
   194         
       
   195         TInt SetForegroundStatus( TBool aIsForeground );
       
   196         
       
   197         const TDesC& RemoteDetails();
       
   198         
       
   199         TBool SendDialTone( TChar aKey);
       
   200         
       
   201         
       
   202     public: // From MLcAudioControl
       
   203         
       
   204         TBool IsLcAudioMutedL();
       
   205 
       
   206         void MuteLcAudioL( TBool aMute );       
       
   207 
       
   208         TBool IsLcMicMutedL();    
       
   209 
       
   210         void MuteLcMicL( TBool aMute );
       
   211         
       
   212         TBool IsEnablingLcLoudspeakerAllowed();
       
   213 
       
   214         void EnableLcLoudspeakerL( TBool aEnabled );
       
   215         
       
   216         TBool IsLcLoudspeakerEnabled();
       
   217 
       
   218         TInt LcVolumeL();
       
   219      
       
   220         void SetLcVolumeL( TInt aValue );    
       
   221     
       
   222         void IncreaseLcVolumeL();
       
   223         
       
   224         void DecreaseLcVolumeL();        
       
   225 
       
   226         
       
   227     protected: // CONSTRUCTORS
       
   228 
       
   229         /**
       
   230         * Constructor
       
   231         *
       
   232         */
       
   233         CMusEngMceSession();
       
   234 
       
   235         /**
       
   236         * Second-phase constructor
       
   237         */
       
   238         void ConstructL();
       
   239                             
       
   240     protected: // Data
       
   241 
       
   242         /**
       
   243         * Drawing area rect.
       
   244         */
       
   245         TRect iRect;
       
   246         
       
   247         /**
       
   248         * ETrue if operator specific behavior is expected
       
   249         */
       
   250         TBool iOperatorVariant;
       
   251 
       
   252         /**
       
   253         * Session state for MLcSession 
       
   254         */
       
   255         MLcSession::TLcSessionState iLcSessionState;       
       
   256                                 
       
   257         TMusEngCameraHandler iCameraHandler;
       
   258 
       
   259         CMusEngLiveVideoPlayer* iLiveVideoPlayer;
       
   260         CMusEngRemoteVideoPlayer* iRemoteVideoPlayer;
       
   261         TRect iSetRemoteRect;
       
   262         TRect iSetLocalRect;
       
   263 	CSVPTimer* iTimer;
       
   264     	TLcSessionState lLcSessionState;
       
   265 	HBufC* iRemoteAddress;
       
   266 	CMccScreen* iScreen;
       
   267 
       
   268     private: // Data
       
   269 
       
   270         /**
       
   271         * The session observer, if present.
       
   272         */
       
   273         MLcSessionObserver* iLcSessionObserver;
       
   274 
       
   275         /**
       
   276         * The UI provider, if present.
       
   277         */        
       
   278         MLcUiProvider* iLcUiProvider;        
       
   279                 
       
   280         /**
       
   281         * Value indicates whether session was started in background mode.
       
   282         * (see IsBackgroundStartup()). Once sending of video started, 
       
   283         * iBackground is set to EFalse
       
   284         */
       
   285         TBool iBackground;
       
   286 
       
   287 
       
   288     };
       
   289     
       
   290 #endif // MUSENGMCESESSION_H