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