tsrc/musenginestub/inc/musengmcesession.h
branchRCL_3
changeset 22 73a1feb507fb
parent 0 f0cf47e981f9
child 23 bc78a40cd63c
equal deleted inserted replaced
21:33a5d2bbf6fc 22:73a1feb507fb
    19 #ifndef MUSHENGMCESESSION_H
    19 #ifndef MUSHENGMCESESSION_H
    20 #define MUSHENGMCESESSION_H
    20 #define MUSHENGMCESESSION_H
    21 
    21 
    22 // USER
    22 // USER
    23 #include "musengsession.h"
    23 #include "musengsession.h"
    24 #include "musengsessiondurationtimerobserver.h"
    24 #include "lcsession.h"
       
    25 #include "lcwindow.h"
       
    26 #include "lcaudiocontrol.h"
    25 
    27 
    26 // SYSTEM
       
    27 /*
       
    28 #include <mcesessionobserver.h>
       
    29 #include <mcestreamobserver.h>
       
    30 #include <mcertpobserver.h>
       
    31 #include <mcetransactiondatacontainer.h>
       
    32 */
       
    33 
       
    34 /*
       
    35 class CMceManager;
       
    36 class CMceSession;
       
    37 */
       
    38 class CMusEngSessionDurationTimer;
       
    39 
       
    40 
       
    41 // CONSTANTS
       
    42 
       
    43 _LIT8( KMusEngAcceptContactHeader,
       
    44        "Accept-Contact: *;+g.3gpp.cs-voice; explicit" );
       
    45 _LIT8( KMusEngSessionSdpLineXApplication, "a=X-application:com.nokia.rtvs" );
       
    46 
    28 
    47 // CLASS DECLARATION
    29 // CLASS DECLARATION
    48 
    30 
    49 /**
    31 /**
    50 * Base class for Multimedia Sharing Engine MCE sessions, inherited by
    32 * Base class for Multimedia Sharing Engine MCE sessions, inherited by
    51 * CMusEngLiveSession CMusEngClipSession and CMusEngReceiveSession.
    33 * CMusEngLiveSession CMusEngClipSession and CMusEngReceiveSession.
    52 *
    34 *
    53 * CMusEngMceSession encapsulates CMCESession and simplifies use of
    35 * CMusEngMceSession encapsulates CMCESession and simplifies use of
    54 * MCE Sessions to user interface. Also splits observers messy events
    36 * MCE Sessions to user interface. Also splits observers messy events
    55 * simplified commands like a SessionDisconnected.
    37 * to simplified function calls.
    56 *
    38 *
    57 * @lib musengine.lib
    39 * @lib musengine.lib
    58 * @since S60 v3.2
       
    59 */
    40 */
    60 class CMusEngMceSession : public CMusEngSession,
    41 class CMusEngMceSession : public CMusEngSession,
    61                           public MMusEngSessionDurationTimerObserver
    42                           public MLcSession,
       
    43                           public MLcWindow,
       
    44                           public MLcAudioControl
    62     {
    45     {
    63 
    46     
    64     public:
    47     public: 
    65 
    48     
    66         /**
    49         /**
    67         * Destructor
    50         * Destructor
    68         *
       
    69         * @since S60 v3.2
       
    70         */
    51         */
    71         ~CMusEngMceSession();
    52         ~CMusEngMceSession();
    72 
    53 
    73 
    54 
    74     public: // API FUNCTIONS
    55     public: // from MLcSession
       
    56         
       
    57         TLcSessionState LcSessionState() const;
       
    58     
       
    59         virtual void EstablishLcSessionL();
       
    60         
       
    61         void TerminateLcSessionL();
       
    62         
       
    63         virtual MLcVideoPlayer* RemoteVideoPlayer();
       
    64     
       
    65         virtual MLcVideoPlayer* LocalVideoPlayer();       
       
    66        
       
    67         virtual const TDesC& LocalDisplayName();
       
    68     
       
    69         virtual const TDesC& RemoteDisplayName();
    75 
    70 
    76         /**
    71         TInt SetParameter( TInt aId, TInt aValue );
    77         * Terminates session.
       
    78         * @pre Session is established
       
    79         * @post Session is ready to be deleted
       
    80         * @leave KErrNotReady if precondition is not fullfilled
       
    81         * @since S60 v3.2
       
    82         */
       
    83         IMPORT_C void TerminateL();
       
    84 
    72 
    85         /**
    73         TInt ParameterValue( TInt aId );
    86         * Releases all this session internal observers. This function is needed
    74         
    87         * before we could get session store out of this session.
    75         void UpdateLcSessionL();
    88         * TODO: Is this function really needed? At least at the moment it is
       
    89         * not called from UI.   -HR 21.8.
       
    90         *
       
    91         * @since S60 v3.2
       
    92         */
       
    93         IMPORT_C void ReleaseInternalObservers();
       
    94 
    76 
    95         /**
    77         
    96         * Get session time return estabilished session time
    78     public: // from MLcWindow
    97         *
    79         
    98         * @since S60 v3.2
    80         void EnableLcWindowL( TBool aEnable );
    99         * @return TTime returns time if connection established else < 0
    81         
   100         */
    82         TBool IsLcWindowEnabled();
   101         IMPORT_C TTimeIntervalSeconds GetSessionTime() const;
    83         
       
    84         void SetLcWindowRectL( TRect aRect );
       
    85         
       
    86         TRect LcWindowRect();
       
    87         
       
    88         void SetLcWindowOrientationL( 
       
    89             TLcWindowOrientation aOrientation );
       
    90         
       
    91         TLcWindowOrientation LcWindowOrientationL();        
       
    92         
       
    93     public: // from MLcAudioControl
       
    94         
       
    95         TBool IsLcAudioMutedL();
   102 
    96 
   103         /**
    97         void MuteLcAudioL( TBool aMute );       
   104         * Returns current connection state
       
   105         *
       
   106         * @since S60 v3.2
       
   107         * @return TBool returns current connection state
       
   108         */
       
   109         IMPORT_C TBool ConnectionActive() const;
       
   110 
    98 
       
    99         TBool IsLcMicMutedL();    
   111 
   100 
   112     public: // VIRTUAL API
   101         void MuteLcMicL( TBool aMute );
       
   102         
       
   103         TBool IsLcLoudspeakerEnabled();
   113 
   104 
   114         // No virtual api
   105         void EnableLcLoudspeakerL( TBool aEnabled );
   115 
   106         
   116 
   107         TBool IsEnablingLcLoudspeakerAllowed();
   117     public: //  from CMusEngSession
   108         
   118 
   109         TInt LcVolumeL();
   119         /**
   110      
   120         * Increases volume level by one
   111         void SetLcVolumeL( TInt aValue );    
   121         *
   112     
   122         * @pre Session is ongoing
   113         void IncreaseLcVolumeL();
   123         * @since S60 v3.2
   114         
   124         */
   115         void DecreaseLcVolumeL();        
   125         IMPORT_C void VolumeUpL();
   116         
   126 
       
   127         /**
       
   128         * Decreases volume level by one
       
   129         *
       
   130         * @pre Session is ongoing
       
   131         * @since S60 v3.2
       
   132         */
       
   133         IMPORT_C void VolumeDownL();
       
   134 
       
   135         /**
       
   136         * Permission to draw on screen device.
       
   137         *
       
   138         * @pre Session is ongoing
       
   139         * @since S60 v3.2
       
   140         */
       
   141         IMPORT_C void EnableDisplayL( TBool aEnable );
       
   142 
       
   143         /**
       
   144         * Implements virtual from CMusEngSession
       
   145         *
       
   146         * @pre Session is ongoing
       
   147         * @since S60 v3.2
       
   148         */
       
   149         IMPORT_C void MuteL();
       
   150 
       
   151         /**
       
   152         * Implements virtual from CMusEngSession
       
   153         *
       
   154         * @pre Session is ongoing
       
   155         * @since S60 v3.2
       
   156         */
       
   157         IMPORT_C void UnmuteL();
       
   158 
       
   159 
       
   160     protected: // CONSTRUCTORS
   117     protected: // CONSTRUCTORS
   161 
   118 
   162         /**
   119         /**
   163         * Constructor
   120         * Constructor
   164         *
   121         *
   165         * @since S60 v3.2
       
   166         */
   122         */
   167         CMusEngMceSession( const TRect& aRect );
   123         CMusEngMceSession( const TRect& aRect );
   168 
   124 
   169         /**
   125         /**
   170         * Second-phase constructor
   126         * Second-phase constructor
   171         *
   127         *
   172         * @since S60 v3.2
       
   173         */
   128         */
   174         void ConstructL();
   129         void ConstructL();
       
   130         
   175 
   131 
       
   132     private:
   176 
   133 
   177     protected: // HELPER FUNCTIONS
   134         MLcWindow::TLcWindowOrientation iOrientation;
   178 
   135         TBool iMuted;
   179         /**
   136         TBool iMicMuted;
   180         *
   137         TBool iLoudspeakerEnabled;
   181         * @since S60 v3.2
   138         TBool iEnablingLoudspeakerAllowed;
   182         */
   139         TInt iVolume;
   183         void RectChangedL();
   140         TRect iRect;
   184 
   141         TBool iWindowEnabled;
   185         /**
       
   186         * Sets session specific SDP line to a session
       
   187         *
       
   188         * @since S60 v3.2
       
   189         */
       
   190         //void SetSessionSdpLinesL( CMceSession& aSession );
       
   191 
       
   192 
       
   193     protected: // internal API
       
   194 
       
   195         /**
       
   196         *
       
   197         * @since S60 v3.2
       
   198         */
       
   199         virtual TBool IsRtpcInactivityTimoutSupported();
       
   200 
       
   201 
       
   202     private: // HELPER FUNCTIONS
       
   203 
       
   204         /**
       
   205         * Start counting session time
       
   206         *
       
   207         * @since S60 v3.2
       
   208         */
       
   209         void InitializeSessionTimer();
       
   210 
       
   211         /**
       
   212         * Callback
       
   213         *
       
   214         * @since S60 v3.2
       
   215         */
       
   216         void UpdateTimerEvent();
       
   217 
       
   218         /**
       
   219         *
       
   220         *
       
   221         * @since S60 v3.2
       
   222         */
       
   223         void DoMuteL( TBool aMute );
       
   224 
       
   225         /**
       
   226         * Increases or decreases current volume of all speakers in session
       
   227         * structure by one.
       
   228         * @pre Current volume of all the speakers is less than MaxVolumeL()
       
   229         *      and at least 1.
       
   230         */
       
   231         void ChangeVolumeByOneL( TBool aIncreaseVolume );
       
   232 
       
   233 
       
   234     private: // Helpers
       
   235 
       
   236         /**
       
   237         * Helper function to avoid three different traps.
       
   238         * Should be replaced when MCE supports different kind of method
       
   239         * detecting end of clip.
       
   240         *
       
   241         * @since S60 v3.2
       
   242         */
       
   243         void CheckClipEndL();
       
   244 
       
   245 
       
   246     public: // MEMBERS
       
   247 
       
   248         /**
       
   249         * Class for connecting to MCE server.
       
   250         * This class provides the connection to the MCE server and
       
   251         * provides functions
       
   252         * for setting observers for asynchronous events.
       
   253         * The user should create only one instance of this class.
       
   254         *
       
   255         * @since S60 v3.2
       
   256         */
       
   257         //CMceManager* iManager;
       
   258 
       
   259         /**
       
   260         * Base class for MCE sessions, inherited by both CMCEInSession and
       
   261         * CMCEOutSession. * CMCESession represents peer-to-peer connection
       
   262         * made with remote terminal. This connection is also known as dialog
       
   263         * and it is set up using SIP INVITE method. The characteristics of the
       
   264         * session are defined by user of this class by attaching media streams
       
   265         * into the session. After the session has been succesfully established,
       
   266         * it can be later updated and must be finally terminated. If for any
       
   267         * reason instance of this class is deleted while in established state,
       
   268         * session is automatically terminated by MCE server.
       
   269         *
       
   270         * @since S60 v3.2
       
   271         */
       
   272         //CMceSession* iSession;
       
   273 
       
   274 
       
   275     public:
       
   276 
       
   277         /**
       
   278         * It is assumed, that user has only one instance of this class.
       
   279         * The same instance is passed between MCE and user, but the data
       
   280         * inside of this container is just updated for each event.
       
   281         *
       
   282         * @since S60 v3.2
       
   283         */
       
   284         //TMceTransactionDataContainer iTransactionDataContainer;
       
   285 
       
   286         /**
       
   287         * Session time. Acts simultaneously as RTCP inactivity timer.
       
   288         *
       
   289         * @since S60 v3.2
       
   290         */
       
   291         TTime iStartTime;
       
   292 
       
   293         CMusEngSessionDurationTimer*   iUpdateTimer;
       
   294 
       
   295         /**
       
   296         * Value indicating seconds gone since last received RTCP sender or
       
   297         * receiver report. Value 20 indicates RTCP inactivity timeout.
       
   298         */
       
   299         TInt iSecondsFromLastRtcpReport;
       
   300         TInt iDisplayEnabled;
       
   301 
   142 
   302     };
   143     };
       
   144     
   303 #endif //MUSHENGMCESESSION_H
   145 #endif //MUSHENGMCESESSION_H