multimediacommscontroller/mmccsubcontroller/inc/mccsymsubthreadclient.h
changeset 0 1bce908db942
equal deleted inserted replaced
-1:000000000000 0:1bce908db942
       
     1 /*
       
     2 * Copyright (c) 2004-2008 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:    Provides an symmetric subthread client definition
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #ifndef MCCSYMSUBTHREADCLIENT_H
       
    22 #define MCCSYMSUBTHREADCLIENT_H
       
    23 
       
    24 //  INCLUDES
       
    25 #include <e32base.h>
       
    26 #include <mmf/server/mmfdatasink.h>
       
    27 #include <mmf/server/mmfdatasource.h>
       
    28 #include "mccsubthreadclientbase.h"
       
    29 #include "mccinternaldef.h"
       
    30 
       
    31 
       
    32 // FORWARD DECLARATIONS
       
    33 class CMccRtpManager;
       
    34 class CMccSymStreamBase;
       
    35 class TMccEvent;
       
    36 class MMccResources;
       
    37 class CMccRtpMediaClock;
       
    38 
       
    39 // CLASS DECLARATION
       
    40 
       
    41 /**
       
    42 *  Mcc Symmetric Subthread Client 
       
    43 *  
       
    44 *  @lib Mccsubthreads.lib
       
    45 *  @since Series 60 3.0
       
    46 */
       
    47 
       
    48 NONSHARABLE_CLASS( CMccSymSubthreadClient ): public CMccSubThreadClientBase,
       
    49     public MAsyncEventHandler
       
    50     {
       
    51     public:  // Constructors and destructor
       
    52         
       
    53         /**
       
    54         * Two-phased constructor.
       
    55         */
       
    56         static CMccSymSubthreadClient* NewL( MMccEventHandler* aObserver,
       
    57                                              MMccResources* aMccResources,
       
    58                                              TInt aLinkType,
       
    59                                              TUint32 aMccSessionId );
       
    60         
       
    61         /**
       
    62         * Destructor.
       
    63         */
       
    64         virtual ~CMccSymSubthreadClient();
       
    65 		
       
    66     public: // Functions from MAsyncEventHandler
       
    67         
       
    68 		TInt SendEventToClient( const TMMFEvent& aEvent );
       
    69 
       
    70     public: // Functions from CMccSubThreadClientBase
       
    71 
       
    72         void OpenL( TInt aStreamType,
       
    73                     TFourCC aFourCC,
       
    74                     MDataSource* aDataSource, 
       
    75                     MDataSink* aSink,
       
    76                     const TUint32 aStreamId,
       
    77                     TMMFPrioritySettings aSettings );
       
    78         
       
    79         void SetBalanceL( const TUint32 aStreamId, 
       
    80                           TInt aLeftBalance, 
       
    81                           TInt aRightBalance );
       
    82 
       
    83         void GetBalanceL( const TUint32 aStreamId, 
       
    84                           TInt& aLeftBalance,
       
    85                           TInt& aRightBalance );
       
    86 
       
    87         void PrepareL( const TUint32 aStreamId,
       
    88         			   const TUint32 aEndpointId );
       
    89 
       
    90         void PlayL( const TUint32 aStreamId,
       
    91 					const TUint32 aEndpointId,
       
    92                     TBool aStreamPaused,
       
    93                     TBool aEnableRTCP );
       
    94 
       
    95         void StopL( const TUint32 aStreamId,
       
    96         			const TUint32 aEndpointId );
       
    97         
       
    98         void PauseL( const TUint32 aStreamId,
       
    99         			 const TUint32 aEndpointId,
       
   100                      TBool aEnableRTCP );
       
   101         void ResumeL( const TUint32 aStreamId,
       
   102         			  const TUint32 aEndpointId,
       
   103                       TBool aEnableRTCP );
       
   104 
       
   105         void CloseL( const TUint32 aStreamId );
       
   106 
       
   107         void CloseL();
       
   108 
       
   109         TBool StreamsExistsL();
       
   110    
       
   111         void SetVolumeL( TInt aVolume );
       
   112 
       
   113         void SetGainL( TInt aGain );
       
   114 
       
   115         TInt MaxVolumeL( const TUint32 aStreamId);
       
   116   
       
   117         TInt MaxGainL( const TUint32 aStreamId );
       
   118 
       
   119         TInt GetVolumeL( const TUint32 aStreamId );
       
   120 
       
   121         TInt GetGainL( const TUint32 aStreamId );
       
   122 
       
   123         void SendMediaSignalL( const TMccEvent& aEvent );
       
   124         
       
   125         /**
       
   126         * Sends RTCP receiver report to uplink if possible.
       
   127         * @param aStreamId - [input] Stream ID identifying stream
       
   128         * @return void
       
   129         */
       
   130         void SendRTCPReceiverReportL( const TUint32 aStreamId );
       
   131 
       
   132         /**
       
   133         * Sends RTCP sender report to uplink if possible.
       
   134         * @param aStreamId - [input] Stream ID identifying stream
       
   135         * @return void
       
   136         */
       
   137         void SendRTCPSenderReportL( const TUint32 aStreamId );
       
   138         
       
   139         /**
       
   140         * Sends Non-RTCP data to uplink if possible.
       
   141         * @param aStreamId - [input] Stream ID identifying stream
       
   142         * @param aData - [input] Data to send
       
   143         * @return void
       
   144         */
       
   145         void SendRTCPDataL( const TUint32 aStreamId,
       
   146                             const TDesC8& aData );
       
   147 
       
   148        /**
       
   149         * Starts inactivity timer for a stream in a given session.
       
   150         * @param aStreamId - [input] Stream ID identifying stream
       
   151         * @param aTimeoutTime - [input] timeout value in milliseconds
       
   152         * @return One of the standard system-wide error codes.
       
   153         */
       
   154         void StartInactivityTimerL( const TUint32 aStreamId,
       
   155                                     TUint32 aTimeoutTime );
       
   156 
       
   157         /**
       
   158         * Stops inactivity timer for a stream in a given session.
       
   159         * @param aStreamId - [input] Stream ID identifying stream
       
   160         * @return One of the standard system-wide error codes.
       
   161         */
       
   162         void StopInactivityTimerL(  const TUint32 aStreamId );
       
   163         
       
   164         /**
       
   165         * Get the supported bitrates from the codec of the specified stream
       
   166         * @since Series 60 3.0
       
   167         * @param aStreamId - [input] Stream ID identifying stream
       
   168         * @param aBitrates Array for the bitrates
       
   169         * @leave System wide error code if unsuccessful
       
   170         * @return None
       
   171         */
       
   172         void GetSupportedBitratesL( const TUint32 aStreamId,
       
   173                                             RArray<TUint>& aBitrates );
       
   174         /**
       
   175         * @See CMccSubThreadClientBase
       
   176         *
       
   177         */                                                 
       
   178         void GetSSRCL( const TUint32 aStreamId, TUint32& aSSRCValue );
       
   179                                            
       
   180         MDataSink* DataSink( const TUint32 aStreamId );
       
   181 
       
   182         MDataSource* DataSource( const TUint32 aStreamId );
       
   183         
       
   184         /**
       
   185         * Get the supported bitrates from the codec of the specified stream
       
   186         * @since Series 60 3.0
       
   187         * @param aStreamId - [input] Stream ID identifying stream
       
   188         * @param aFmtp [output] The FMTP attribute
       
   189         * @return None
       
   190         */
       
   191         void GetFmtpAttrL( const TUint32 aStreamId, TDes8& aFmtp );
       
   192         	
       
   193 		void SetRemoteAddressL( TInetAddr aRemAddr );
       
   194 		
       
   195 		void SetRemoteRtcpAddrL( TInetAddr aRemAddr );
       
   196 		
       
   197 		/**
       
   198         * 2nd step to create link
       
   199         * @since Series 60 3.0
       
   200         * @param [input/output] aStatus
       
   201         * @param [input] aIapId
       
   202         * @return void
       
   203         */
       
   204 		void InitializeLinkL( TRequestStatus& aStatus, TInt aIapId );
       
   205 		
       
   206 		/**
       
   207         * 3rd step to create link. Creates a RTP session in the subthread
       
   208         * @since Series 60 3.0
       
   209         * @param [input/output] aPort
       
   210         * @param [input] aEnableRTCP
       
   211         * @param [input] TOS bit settings
       
   212         * @param [input] Reference to RTP Media Clock instance
       
   213         * @return void
       
   214         */	
       
   215 		void CreateRtpSessionL( TUint aPort, 
       
   216         	                    TBool aEnableRTCP, 
       
   217         	                    TInt aIpTos,
       
   218         	                    CMccRtpMediaClock& aClock );
       
   219         
       
   220         void SetAudioRouteL( TUint32 aStreamId,
       
   221                              TUint32 aRoutingDestination );
       
   222         
       
   223         void GetAudioRouteL( TUint32 aStreamId,
       
   224                              TUint32& aRoutingDestination );
       
   225                              
       
   226         void UnuseL( TUint32 aStreamId );
       
   227         
       
   228         /**
       
   229         * Resolves and returns local IP addresses and ports
       
   230         * @since Series 60 3.2
       
   231         * @param [input/output] aClientData Client data
       
   232         * @return void
       
   233         */
       
   234         void GetLocalIpAddressesL( TMccCreateLink& aClientData );
       
   235 
       
   236         void SetParameterL( TUint32 aParam,
       
   237                             TUint32 aStreamId,
       
   238                             TUint32 aEndpointId,
       
   239                             const TDesC8& aVal );
       
   240          
       
   241         void GetParameterL( TUint32 aParam,
       
   242                             TUint32 aStreamId,
       
   243                             TUint32 aEndpointId,
       
   244                             TDesC8& aVal );
       
   245         
       
   246 
       
   247         /**
       
   248          * Bind context into stream.
       
   249          * @since Series 60 3.2
       
   250          * @param aStreamId The stream id
       
   251          * @param aEndpointId The endpoint id
       
   252          * @param aContextParams Crypto context
       
   253          * @return void
       
   254          */		
       
   255         void BindContextIntoStreamL( TUint32 aStreamId, 
       
   256                                      TUint32 aEndpointId,
       
   257                                      const TMccCryptoContext& aContextParams );
       
   258                                      
       
   259         /**
       
   260          * Remove context.
       
   261          * @since Series 60 3.2
       
   262          * @param aStreamId The stream id
       
   263          * @param aEndpointId The endpoint id
       
   264 
       
   265          * @return void
       
   266          */		
       
   267         void RemoveContextL( TUint32 aStreamId, 
       
   268                              TUint32 aEndpointId );
       
   269         
       
   270     private:  // Private construction
       
   271 
       
   272         /**
       
   273         * C++ default constructor.
       
   274         */
       
   275         CMccSymSubthreadClient( MMccEventHandler* aObserver,
       
   276                                 MMccResources* aMccResources,
       
   277                                 TInt aLinkType,
       
   278                                 TUint32 aMccSessionId );
       
   279 
       
   280         /**
       
   281         * By default Symbian 2nd phase constructor is private.
       
   282         */
       
   283         void ConstructL();
       
   284 
       
   285     
       
   286     private:  // New functions
       
   287     
       
   288 		void DoMccEvent( TMccEvent& aEvent, const TMMFEvent& aMMFEvent );
       
   289 		
       
   290 		TInt HandleAmrEvent( const TMMFEvent& aEvent,
       
   291 		                     const TMccEvent& aMccEvent );
       
   292 		
       
   293     private:    // Data
       
   294         		        
       
   295         // Priority settings
       
   296         TMMFPrioritySettings iPrioritySettingsData;
       
   297         
       
   298         RArray<TUint32> iUnusedStreams;
       
   299 
       
   300         // Rtp media clock instance
       
   301         CMccRtpMediaClock* iRtpMediaClock;
       
   302                         
       
   303         #ifdef TEST_EUNIT
       
   304         friend class UT_CMccSymSubthreadClient;
       
   305         #endif
       
   306 
       
   307     };
       
   308 
       
   309 #endif      // MCCSYMSUBTHREADCLIENT_H  
       
   310 
       
   311 // End of File
       
   312