mmsharing/mmshengine/inc/musengreceivesession.h
changeset 0 f0cf47e981f9
child 22 73a1feb507fb
equal deleted inserted replaced
-1:000000000000 0:f0cf47e981f9
       
     1 /*
       
     2 * Copyright (c) 2006 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 MUSHENGREVEIVESESSION_H
       
    20 #define MUSHENGREVEIVESESSION_H
       
    21 
       
    22 
       
    23 
       
    24 #include "musengmcesession.h"
       
    25 #include "musenguriparser.h"
       
    26 #include "musunittesting.h"
       
    27 
       
    28 #include <mcemediasink.h>
       
    29 
       
    30 class MMusEngReceiveSessionObserver;
       
    31 class CMceInSession;
       
    32 
       
    33 class CMusEngReceiveSession : public CMusEngMceSession
       
    34     {
       
    35     MUS_UNITTEST( UT_CMusEngMceSession )
       
    36     MUS_UNITTEST( UT_CMusEngReceiveSession )
       
    37     
       
    38     public: // Contructors and destructor
       
    39 
       
    40        /**
       
    41         * Creates new MultimediaSharing Receive session.
       
    42         *
       
    43         * @param aRect UI drawing area. It is allowed handle from engine
       
    44         * @param aEngObserver Engine specific callbacks
       
    45         * @param aSessionObserver Session specific callbacks
       
    46         * @return CMusEngReceiveSession* New instanse of specified class
       
    47         */
       
    48         IMPORT_C static CMusEngReceiveSession* NewL( 
       
    49                     const TRect& aRect,
       
    50                     MMusEngSessionObserver& aSessionObserver,
       
    51                     MMusEngReceiveSessionObserver& aReceiveSessionObserver );
       
    52        /**
       
    53         * Destructor
       
    54         *
       
    55         * @since S60 v3.2
       
    56         */
       
    57         ~CMusEngReceiveSession();
       
    58       
       
    59         
       
    60     public: // API
       
    61 
       
    62        /**
       
    63         * Accept or deny processed invitation
       
    64         *
       
    65         * @param aAccept ETrue if session is to be accepted and EFalse if 
       
    66         *        to be rejected.
       
    67         */
       
    68         IMPORT_C void AcceptInvitationL(const TBool& aAccept);
       
    69    
       
    70 
       
    71     private: // Overrides function in CMusEngMceSession
       
    72     
       
    73         /**
       
    74         * The state of the session has changed.
       
    75         *
       
    76         * @since S60 v3.2
       
    77         * @param aSession, the session that has changed.
       
    78         */
       
    79         virtual void HandleSessionStateChanged( CMceSession& aSession,
       
    80                                                 TInt aStatusCode,
       
    81                                                 const TDesC8& aReasonPhrase );
       
    82         
       
    83         /**
       
    84         * Sets Multimediasharing specific video codec settings like keepalive
       
    85         * timer. This functions gets called for every video codec in 
       
    86         * session. This function overrides function in base class. 
       
    87         * Function calls also overridden version.
       
    88         */ 
       
    89         virtual void AdjustVideoCodecL( CMceVideoCodec& aVideoCodec );
       
    90         
       
    91         /**
       
    92         * Sets Multimediasharing specific audio codec settings like keepalive
       
    93         * timer. This functions gets called for every audio 
       
    94         * codec in session.  This function overrides function in base class. 
       
    95         * Function calls also overridden version.
       
    96         */ 
       
    97         virtual void AdjustAudioCodecL( CMceAudioCodec& aAudioCodec );
       
    98         
       
    99         /**
       
   100         * Removes multiples of H.263 codec, prefers H263-2000 over H263-1998.
       
   101         * Additionally selects just the one with best quality from selected mode.
       
   102         * Removes all the H.263 codecs if any AVC codecs found. Prefers
       
   103         * non-interleaved AVC over single NAL AVC
       
   104         * @param aVideoStream
       
   105         */
       
   106         virtual void DoCodecSelectionL( CMceVideoStream& aVideoStream );
       
   107                          
       
   108                          
       
   109     private: // from MMceInSessionObserver
       
   110              // overrides the function in CMusEngMceSession
       
   111 
       
   112         /**
       
   113 	    * Incoming session invitation. The CMCEInSession is given to the
       
   114 		* application as a callback.
       
   115 	    * @param aSession, pointer to the incoming session. Ownership is
       
   116 		*	     transferred.
       
   117 	    * @param aContainer, if present, holds details of
       
   118 	    *        transaction causing state change.
       
   119 	    */
       
   120         void IncomingSession(
       
   121 	                CMceInSession* aSession,
       
   122     				TMceTransactionDataContainer* aContainer );
       
   123     				
       
   124     				
       
   125 	    /**
       
   126 	    * Incoming session update. The new updated CMCEInSession is given to the
       
   127 		* application as a callback.
       
   128 	    * @param aOrigSession, the original session to be updated. This instance
       
   129 	    *        cannot be used anymore, all actions done using aUpdatedSession 
       
   130 	    *        instance.
       
   131 	    * @param aUpdatedSession, pointer to the new updated session. Ownership 
       
   132 	    *        is transferred.
       
   133 	    * @param aContainer, if present, holds details of update transaction.
       
   134 	    */
       
   135 		void IncomingUpdate(
       
   136 					CMceSession& aOrigSession, 
       
   137 					CMceInSession* aUpdatedSession,
       
   138     				TMceTransactionDataContainer* aContainer );
       
   139 
       
   140 
       
   141     private: // from MMceStreamObserver, 
       
   142              // overrides the function in CMusEngMceSession
       
   143 
       
   144         /**
       
   145         * The state of the stream has changed.
       
   146         *
       
   147         * @since S60 v3.2
       
   148         * @param aStream, the stream that uses the source.
       
   149         */
       
   150         void StreamStateChanged( CMceMediaStream& aStream );
       
   151 
       
   152 
       
   153     private: // CONSTRUCTORS
       
   154     
       
   155         CMusEngReceiveSession(  
       
   156                         MMusEngSessionObserver& aSessionObserver,
       
   157                         MMusEngReceiveSessionObserver& aReceiveSessionObserver,
       
   158                         const TRect& aRect );
       
   159 
       
   160 		void ConstructL();
       
   161 		
       
   162     private: // HELPERS
       
   163     
       
   164         CMceInSession* InSession();
       
   165         
       
   166         void PrepareToRequire100RelL( 
       
   167                         TMceTransactionDataContainer* aContainer);
       
   168         
       
   169         void CompleteSessionStructureL();
       
   170         
       
   171          /**
       
   172          * Parse P-Asserted-Identity header. 
       
   173          * Tries to fetch the telephone number from tel uri, 
       
   174          * if tel uri not found it suppose that telephone number
       
   175          * is in sip url. 
       
   176          */
       
   177         void ParseAssertedIdentity(
       
   178                         TMceTransactionDataContainer* aContainer );
       
   179         
       
   180     private: // DATA
       
   181     
       
   182         MMusEngReceiveSessionObserver& iReceiveSessionObserver;
       
   183     
       
   184         // Set to ETrue if CMceInSession::RingL has already been called
       
   185         TBool iRingLCalled;
       
   186         
       
   187         // identity of originator parsed form P-Asserted-Identity field
       
   188         TBuf8<KMaxUriLength> iIdentity;
       
   189     };
       
   190 
       
   191 #endif
       
   192