mmresourcemgmt/mmresctrl/inc/mmrcadaptationproxy.h
changeset 0 40261b775718
equal deleted inserted replaced
-1:000000000000 0:40261b775718
       
     1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // mmrcserverphysicaladaptation.h
       
    15 // 
       
    16 //
       
    17 
       
    18 #ifndef MMRCPHYSICALADAPTATION_H_
       
    19 #define MMRCPHYSICALADAPTATION_H_
       
    20 
       
    21 #include <e32std.h>
       
    22 #include <e32base.h>
       
    23 #include <a3f/a3fbase.h>
       
    24 #include <a3f/a3f_trace_utils.h>
       
    25 #include "mmrcclientserver.h"
       
    26 #include "maudiostreamadaptationobserver.h"
       
    27 
       
    28 class MLogicalChain;
       
    29 class MAudioContext;
       
    30 class CFourCCConvertor;
       
    31 class CMMRCServerSideAdaptationResponseAO;
       
    32 class CAudioStreamAdaptation;
       
    33 class CMMRCServerSession;
       
    34 
       
    35 //------------------------------------------------------------------------------------
       
    36 // CMMRCClientSideServerRequestToAdaptationAO
       
    37 //------------------------------------------------------------------------------------
       
    38 
       
    39 /**
       
    40 @internalComponent
       
    41 
       
    42 This class implements the proxy to the Physical adaptation.
       
    43 The main purpose of this class is to communicate with the physical resource manager.
       
    44 */
       
    45 NONSHARABLE_CLASS( CMMRCClientSideServerRequestToAdaptationAO ): public CActive, public MAudioStreamAdaptationObserver
       
    46 	{
       
    47 public:
       
    48 	/**
       
    49 	 * Constructs, and returns a pointer to, a new CMMRCClientSideServerRequestToAdaptationAO object.
       
    50 	 * Leaves on failure.
       
    51 	 * @param CMMRCServerController& A reference on the MMRC Server controller
       
    52 	 * @return CMMRCClientSideServerRequestToAdaptationAO* A pointer to newly created utlitly object.
       
    53 	 */
       
    54 	IMPORT_C static CMMRCClientSideServerRequestToAdaptationAO* NewL( );
       
    55 
       
    56 	/**
       
    57 	 * Destructor.
       
    58 	 */
       
    59 	~CMMRCClientSideServerRequestToAdaptationAO( );
       
    60 
       
    61 public:
       
    62 	void Initialize(CMMRCServerSession* aServerSession,
       
    63 					CMMRCServerSideAdaptationResponseAO* aCallback,
       
    64 					RThread* aClientThread,
       
    65 					const CFourCCConvertor& aFourCCConvertor);
       
    66 
       
    67 	void Service(TUint aRequestType);
       
    68 
       
    69 	/**
       
    70 	 * Callback in case of timeout
       
    71 	 */
       
    72 	void ResourceRequestAcknowledgmentTimeout( );
       
    73 
       
    74 	// from MAudioStreamAdaptationObserver
       
    75 	void PhysicalAdaptationEvent(TPhysicalEvent aEvent, TInt aError);
       
    76 	void StateEvent(TInt aReason, TAudioState aNewState);
       
    77 	void AddProcessingUnitComplete(TUid aType, TInt aError);
       
    78 	void RemoveProcessingUnitComplete(TUid aType, TInt aError);
       
    79 	void ProcessingFinished();
       
    80 	void FlushComplete(TInt aError);
       
    81 
       
    82 	//From CActive
       
    83 	virtual void RunL();
       
    84 	virtual void DoCancel();
       
    85 
       
    86 private:
       
    87 	/**
       
    88 	 * By default Symbian 2nd phase constructor is private.
       
    89 	 * @param CMMRCServerController& A reference on the MMRC Server controller
       
    90 	 */
       
    91 	CMMRCClientSideServerRequestToAdaptationAO( );
       
    92 
       
    93 	void TidyUp();
       
    94 
       
    95 	/**
       
    96 	 * By default Symbian 2nd phase constructor is private.
       
    97 	 */
       
    98 	void ConstructL( );
       
    99 
       
   100 private:
       
   101 	//owned
       
   102 	CAudioStreamAdaptation* iStreamAdaptation;
       
   103 
       
   104 	//not owned
       
   105 	RThread* iClientThread;
       
   106 	CMMRCServerSession* iServerSession;
       
   107 	CMMRCServerSideAdaptationResponseAO* iMMRCServerSideAdaptationResponseAO;
       
   108 
       
   109 	MLogicalChain* iLogicalChainRequested;
       
   110 	MLogicalChain* iLogicalChainLastCommited;
       
   111 	MAudioContext* iAudioContext;
       
   112 	TInt iRequestsProcessed;
       
   113 	TUint iRequestType;
       
   114 	};
       
   115 
       
   116 //------------------------------------------------------------------------------------
       
   117 // CMMRCServerSideAdaptationResponseAO
       
   118 //------------------------------------------------------------------------------------
       
   119 
       
   120 /**
       
   121 @internalComponent
       
   122 
       
   123 */
       
   124 NONSHARABLE_CLASS( CMMRCServerSideAdaptationResponseAO ) : public CActive
       
   125 	{
       
   126 public:
       
   127 	~CMMRCServerSideAdaptationResponseAO();
       
   128 	static CMMRCServerSideAdaptationResponseAO* NewL();
       
   129 	void Initialize(CMMRCServerSession* aServerSession, RThread* iServerThread );
       
   130 	void Service(TMMRCAdaptationToServerRequestResults aEvent, TInt aError);
       
   131 	void StartAdaptationListening();
       
   132 private:
       
   133 	CMMRCServerSideAdaptationResponseAO();
       
   134 	void ConstructL( );
       
   135 	void RunL( );
       
   136 	void DoCancel( );
       
   137 
       
   138 private:
       
   139 	//not owned
       
   140 	CMMRCServerSession* iMMRCServerSession;
       
   141 	RThread* iServerThread;
       
   142 
       
   143 	TMMRCAdaptationToServerRequestResults iEvent;
       
   144 	TInt iError;
       
   145 	};
       
   146 
       
   147 #endif /*MMRCPHYSICALADAPTATION_H_*/