tsrc/musenginestub/inc/musengmcesession.h
branchRCL_3
changeset 33 bc78a40cd63c
parent 32 73a1feb507fb
equal deleted inserted replaced
32:73a1feb507fb 33:bc78a40cd63c
    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 "lcsession.h"
    24 #include "musengsessiondurationtimerobserver.h"
    25 #include "lcwindow.h"
    25 
    26 #include "lcaudiocontrol.h"
    26 // SYSTEM
    27 
    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" );
    28 
    46 
    29 // CLASS DECLARATION
    47 // CLASS DECLARATION
    30 
    48 
    31 /**
    49 /**
    32 * Base class for Multimedia Sharing Engine MCE sessions, inherited by
    50 * Base class for Multimedia Sharing Engine MCE sessions, inherited by
    33 * CMusEngLiveSession CMusEngClipSession and CMusEngReceiveSession.
    51 * CMusEngLiveSession CMusEngClipSession and CMusEngReceiveSession.
    34 *
    52 *
    35 * CMusEngMceSession encapsulates CMCESession and simplifies use of
    53 * CMusEngMceSession encapsulates CMCESession and simplifies use of
    36 * MCE Sessions to user interface. Also splits observers messy events
    54 * MCE Sessions to user interface. Also splits observers messy events
    37 * to simplified function calls.
    55 * simplified commands like a SessionDisconnected.
    38 *
    56 *
    39 * @lib musengine.lib
    57 * @lib musengine.lib
       
    58 * @since S60 v3.2
    40 */
    59 */
    41 class CMusEngMceSession : public CMusEngSession,
    60 class CMusEngMceSession : public CMusEngSession,
    42                           public MLcSession,
    61                           public MMusEngSessionDurationTimerObserver
    43                           public MLcWindow,
       
    44                           public MLcAudioControl
       
    45     {
    62     {
    46     
    63 
    47     public: 
    64     public:
    48     
    65 
    49         /**
    66         /**
    50         * Destructor
    67         * Destructor
       
    68         *
       
    69         * @since S60 v3.2
    51         */
    70         */
    52         ~CMusEngMceSession();
    71         ~CMusEngMceSession();
    53 
    72 
    54 
    73 
    55     public: // from MLcSession
    74     public: // API FUNCTIONS
    56         
    75 
    57         TLcSessionState LcSessionState() const;
    76         /**
    58     
    77         * Terminates session.
    59         virtual void EstablishLcSessionL();
    78         * @pre Session is established
    60         
    79         * @post Session is ready to be deleted
    61         void TerminateLcSessionL();
    80         * @leave KErrNotReady if precondition is not fullfilled
    62         
    81         * @since S60 v3.2
    63         virtual MLcVideoPlayer* RemoteVideoPlayer();
    82         */
    64     
    83         IMPORT_C void TerminateL();
    65         virtual MLcVideoPlayer* LocalVideoPlayer();       
    84 
    66        
    85         /**
    67         virtual const TDesC& LocalDisplayName();
    86         * Releases all this session internal observers. This function is needed
    68     
    87         * before we could get session store out of this session.
    69         virtual const TDesC& RemoteDisplayName();
    88         * TODO: Is this function really needed? At least at the moment it is
    70 
    89         * not called from UI.   -HR 21.8.
    71         TInt SetParameter( TInt aId, TInt aValue );
    90         *
    72 
    91         * @since S60 v3.2
    73         TInt ParameterValue( TInt aId );
    92         */
    74         
    93         IMPORT_C void ReleaseInternalObservers();
    75         void UpdateLcSessionL();
    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         
   102 
    84         void SetLcWindowRectL( TRect aRect );
   103         /**
    85         
   104         * Returns current connection state
    86         TRect LcWindowRect();
   105         *
    87         
   106         * @since S60 v3.2
    88         void SetLcWindowOrientationL( 
   107         * @return TBool returns current connection state
    89             TLcWindowOrientation aOrientation );
   108         */
    90         
   109         IMPORT_C TBool ConnectionActive() const;
    91         TLcWindowOrientation LcWindowOrientationL();        
   110 
    92         
   111 
    93     public: // from MLcAudioControl
   112     public: // VIRTUAL API
    94         
   113 
    95         TBool IsLcAudioMutedL();
   114         // No virtual api
    96 
   115 
    97         void MuteLcAudioL( TBool aMute );       
   116 
    98 
   117     public: //  from CMusEngSession
    99         TBool IsLcMicMutedL();    
   118 
   100 
   119         /**
   101         void MuteLcMicL( TBool aMute );
   120         * Increases volume level by one
   102         
   121         *
   103         TBool IsLcLoudspeakerEnabled();
   122         * @pre Session is ongoing
   104 
   123         * @since S60 v3.2
   105         void EnableLcLoudspeakerL( TBool aEnabled );
   124         */
   106         
   125         IMPORT_C void VolumeUpL();
   107         TBool IsEnablingLcLoudspeakerAllowed();
   126 
   108         
   127         /**
   109         TInt LcVolumeL();
   128         * Decreases volume level by one
   110      
   129         *
   111         void SetLcVolumeL( TInt aValue );    
   130         * @pre Session is ongoing
   112     
   131         * @since S60 v3.2
   113         void IncreaseLcVolumeL();
   132         */
   114         
   133         IMPORT_C void VolumeDownL();
   115         void DecreaseLcVolumeL();        
   134 
   116         
   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 
   117     protected: // CONSTRUCTORS
   160     protected: // CONSTRUCTORS
   118 
   161 
   119         /**
   162         /**
   120         * Constructor
   163         * Constructor
   121         *
   164         *
       
   165         * @since S60 v3.2
   122         */
   166         */
   123         CMusEngMceSession( const TRect& aRect );
   167         CMusEngMceSession( const TRect& aRect );
   124 
   168 
   125         /**
   169         /**
   126         * Second-phase constructor
   170         * Second-phase constructor
   127         *
   171         *
       
   172         * @since S60 v3.2
   128         */
   173         */
   129         void ConstructL();
   174         void ConstructL();
   130         
   175 
   131 
   176 
   132     private:
   177     protected: // HELPER FUNCTIONS
   133 
   178 
   134         MLcWindow::TLcWindowOrientation iOrientation;
   179         /**
   135         TBool iMuted;
   180         *
   136         TBool iMicMuted;
   181         * @since S60 v3.2
   137         TBool iLoudspeakerEnabled;
   182         */
   138         TBool iEnablingLoudspeakerAllowed;
   183         void RectChangedL();
   139         TInt iVolume;
   184 
   140         TRect iRect;
   185         /**
   141         TBool iWindowEnabled;
   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;
   142 
   301 
   143     };
   302     };
   144     
       
   145 #endif //MUSHENGMCESESSION_H
   303 #endif //MUSHENGMCESESSION_H