multimediacommscontroller/mmccqoscontroller/inc/mccqoscontroller.h
changeset 0 1bce908db942
equal deleted inserted replaced
-1:000000000000 0:1bce908db942
       
     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 
       
    20 
       
    21 #ifndef MCCQOSCONTROLLER_H
       
    22 #define MCCQOSCONTROLLER_H
       
    23 
       
    24 //  INCLUDES
       
    25 #include <e32base.h>
       
    26 #include "mccrateadaptationdef.h"
       
    27 #include "mccinternalevents.h"
       
    28 #include "mmccevents.h"
       
    29 
       
    30 // CONSTANTS
       
    31 
       
    32 // MACROS
       
    33 
       
    34 // DATA TYPES
       
    35 
       
    36 // FUNCTION PROTOTYPES
       
    37 
       
    38 // FORWARD DECLARATIONS
       
    39 class MMccRateAdaptationObserver;
       
    40 class MMccResources;
       
    41 class TMccEvent;
       
    42 class CDeltaTimer;
       
    43 class MDataSink;
       
    44 class MDataSource;
       
    45 
       
    46 // CLASS DECLARATION
       
    47 
       
    48 class TMccQosControllerIcmpError
       
    49     {
       
    50     public:
       
    51     
       
    52         TMccQosControllerIcmpError() :
       
    53             iLinkId( 0 ),
       
    54             iErrorTimeWindowBeginning( 0 ),
       
    55             iErrorCount( 0 )
       
    56             {
       
    57             }
       
    58             
       
    59     public:
       
    60     
       
    61         TUint32 iLinkId;
       
    62         TTime iErrorTimeWindowBeginning;
       
    63         TInt iErrorCount;
       
    64     };
       
    65 
       
    66 /**
       
    67 *
       
    68 */
       
    69 class CMccQosController : public CBase
       
    70     {
       
    71     public:  // Constructors and destructor
       
    72         
       
    73         /**
       
    74         * Two-phased constructor.
       
    75         */
       
    76         IMPORT_C static CMccQosController* NewL( MMccRateAdaptationObserver& aObserver, 
       
    77                                         MMccResources& aResources );
       
    78         
       
    79         /**
       
    80         * Destructor.
       
    81         */
       
    82         IMPORT_C ~CMccQosController();
       
    83 
       
    84     public: // New functions
       
    85     
       
    86         /**
       
    87         * Processes event if it is qos related.
       
    88         * @param aEvent
       
    89         * @return ETrue if event should be ignored, otherwise EFalse
       
    90         */
       
    91         IMPORT_C TBool EventReceived( const TMccEvent& aEvent );       
       
    92 
       
    93     public: // Functions from base classes       
       
    94         
       
    95     protected:  // New functions
       
    96 
       
    97     protected:  // Functions from base classes
       
    98 
       
    99     private:
       
   100 
       
   101         /**
       
   102         * C++ default constructor.
       
   103         */
       
   104         CMccQosController( MMccRateAdaptationObserver& aObserver,
       
   105                            MMccResources& aResources );
       
   106 
       
   107         /**
       
   108         * By default Symbian 2nd phase constructor is private.
       
   109         */
       
   110         void ConstructL();
       
   111         void DoAdaptationCalculations();
       
   112         void FillRateAdaptationEvent();
       
   113         void ClearRateEventData();
       
   114         
       
   115         /**
       
   116 		*Starts timer of type CDeltaTimer, 
       
   117 		*which callback is AsyncTimerExpired function
       
   118 		*/
       
   119 		void StartTimerForAsync();
       
   120 		
       
   121 		/**
       
   122 		* A callback for CDeltaTimer
       
   123 		*/
       
   124 		static TInt AsyncTimerExpired(TAny* aPtr);
       
   125         
       
   126         void GetSinkSources();
       
   127         
       
   128         void CheckRateChangeResult(TInt aValue);
       
   129         
       
   130         TBool HandleIcmpError( const TMccEvent& aEvent );
       
   131         
       
   132         static TBool IcmpErrorMatch( const TMccQosControllerIcmpError& aError1, 
       
   133                                      const TMccQosControllerIcmpError& aError2 );
       
   134         
       
   135         static TBool IcmpErrorCleanup( const TMccQosControllerIcmpError& aError1, 
       
   136                                        const TMccQosControllerIcmpError& aError2 );
       
   137         
       
   138         void DoAdaptation();
       
   139         
       
   140         TInt GetShortTermComparisonDelay();
       
   141         
       
   142         TInt CalculateDelayOfShortTermPeriod();
       
   143 
       
   144     public:     // Data
       
   145     
       
   146     protected:  // Data
       
   147 
       
   148     private:    // Data
       
   149     
       
   150         MMccRateAdaptationObserver& iMainObserver;
       
   151         MMccResources& 				iResources;
       
   152         TInt 						iRoundTripTime;
       
   153         TRtpPeerStat 				iStreamStat;
       
   154         TMccRateAdaptationEventData iRateEventData;
       
   155         TMccEvent					iEvent;
       
   156         TMccEvent					iResultEvent;
       
   157         TThresholdValues 			iThresholdValues; //rate control threshold values
       
   158         CDeltaTimer* 				iDeltaTimer;
       
   159         TCallBack 					iDeltaTimerCallBack;
       
   160 		TDeltaTimerEntry 			iDeltaTimerEntry;
       
   161 		
       
   162        TBool						iBitRateChanged;
       
   163        TUint						iEventCounter;
       
   164        TBool                        iAdapted;
       
   165        TInt                         iRoundTripDelayOfPreviousShortPeriod;
       
   166        TInt                         iRoundTripDelays[ KMccShortTermCalculation ];
       
   167         RArray<TMccQosControllerIcmpError> iIcmpErrors;
       
   168        
       
   169     public:     // Friend classes
       
   170 
       
   171     protected:  // Friend classes
       
   172 
       
   173     private:    // Friend classes
       
   174 
       
   175     #ifdef TEST_EUNIT
       
   176     friend class UT_CMccQosController;
       
   177     #endif
       
   178 
       
   179     };
       
   180 
       
   181 #endif      // MCCQOSCONTROLLER_H   
       
   182             
       
   183 // End of File