devsound/devsoundpluginsupport/src/CustomInterfaces/cmmfdevsoundcibitrate.h
changeset 0 79dd3e2336a0
equal deleted inserted replaced
-1:000000000000 0:79dd3e2336a0
       
     1 // Copyright (c) 2005-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 //
       
    15 
       
    16 #ifndef CMMFDEVSOUNDCIBITRATE_H
       
    17 #define CMMFDEVSOUNDCIBITRATE_H
       
    18 
       
    19 #include <e32base.h>
       
    20 #include <mmf/common/mmfipc.h>
       
    21 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
       
    22 #include <mmf/common/mmfipcserver.h>
       
    23 #endif
       
    24 #include <mmf/server/mmfdevsoundcustominterface.h>
       
    25 #include <mmf/server/mmfdevsoundcustomcommands.h>
       
    26 #include <mmf/server/devsoundstandardcustominterfaces.h>
       
    27 
       
    28 /**
       
    29  @internalComponent
       
    30  @prototype
       
    31  @file
       
    32  */
       
    33 
       
    34 enum TMMFDevSoundCIBitRateCommands
       
    35 	{
       
    36 	EMMFDevSoundCIBitRateBitRate = 0,
       
    37 	EMMFDevSoundCIBitRateSetBitRate,
       
    38 	EMMFDevSoundCIBitRateGetSupportedBitRates,
       
    39 	EMMFDevSoundCIBitRateGetSupportedBitRatesArray
       
    40 	};
       
    41 
       
    42 /**
       
    43  * CMMFDevSoundCIBitRate
       
    44  *
       
    45  * implementation of the BitRate custom interface pair
       
    46  */
       
    47 class CMMFDevSoundCIBitRateMux : public CBase,
       
    48 			      	 			 public MMMFDevSoundCustomInterfaceMuxPlugin,
       
    49 			      	 			 public MMMFDevSoundCustomInterfaceBitRate
       
    50 	{
       
    51 public:
       
    52 	/**
       
    53 	Attempt to open the interface.
       
    54 	@param aInterfaceId
       
    55 		   The UID of the interface to open.
       
    56 	@return one of the system wide error codes
       
    57 	*/
       
    58 	virtual TInt OpenInterface(TUid aInterfaceId);
       
    59 
       
    60 	/**
       
    61 	Equivalent to destructor.  Called to destroy plugin.
       
    62 	*/
       
    63 	virtual void Release();
       
    64 	/**
       
    65 	Pass destructor key.
       
    66 	Called on construction so plugin takes responsibility to call REComSession::DestroyedImplementation()
       
    67 	@param aDestructorKey
       
    68 	       The Uid returned by REComSession::CreateImplementationL() or similar
       
    69 	*/
       
    70 	virtual void PassDestructorKey(TUid aDestructorKey);
       
    71 	
       
    72 	/**
       
    73 	Complete construction.
       
    74 	Pass additional values from the construction phase, used subsequently by the plugin.
       
    75 	@param aCustomUtility
       
    76 	       The custom interface utility used by the plugin to communicate with the remote
       
    77 		   server side DeMux plugin
       
    78 	*/
       
    79 	virtual void CompleteConstructL(MMMFDevSoundCustomInterfaceMuxUtility* aCustomUtility);
       
    80 
       
    81 	/** 
       
    82 	Return the custom interface
       
    83 	@param aInterfaceId
       
    84 		   The UID of the required custom interface
       
    85 	@return the custom interface supported by this plugin
       
    86 	*/
       
    87 	virtual TAny* CustomInterface(TUid aInterfaceId);
       
    88 
       
    89 	/**
       
    90 	Instantiate a CMMFDevSoundCIBitRateMux class
       
    91 	@return the pointer to the new class, cast to the Mux plugin mixin
       
    92 	*/
       
    93 	static MMMFDevSoundCustomInterfaceMuxPlugin* NewL();
       
    94 
       
    95 protected:
       
    96 	// from MMMFDevSoundCustomInterfaceBitRate
       
    97 	virtual void GetSupportedBitRatesL(RArray<TInt>& aSupportedBitRates);
       
    98 	virtual TInt BitRateL();
       
    99 	virtual void SetBitRateL(TInt aBitRate);
       
   100 
       
   101 	CMMFDevSoundCIBitRateMux();
       
   102 	~CMMFDevSoundCIBitRateMux();
       
   103 
       
   104 protected:
       
   105 	TUid iKey;
       
   106 	TInt iRemoteHandle;
       
   107 	MMMFDevSoundCustomInterfaceMuxUtility* iUtility;
       
   108 	};
       
   109 
       
   110 
       
   111 /**
       
   112  * DeMux side of pair
       
   113  */
       
   114 
       
   115 class CMMFDevSoundCIBitRateDeMux : public CBase,
       
   116 			      	   			   public MMMFDevSoundCustomInterfaceDeMuxPlugin
       
   117 	{
       
   118 public:
       
   119 	/**
       
   120 	Instantiate a CMMFDevSoundCIBitRateDeMux class
       
   121 	@return a pointer to the new class cast to the DeMux plugin mixin
       
   122 	*/
       
   123 	static MMMFDevSoundCustomInterfaceDeMuxPlugin* NewL();
       
   124 		
       
   125 	/**
       
   126 	Attempt to open the interface.
       
   127 	@param aInterfaceId
       
   128 		   The UID of the interface to open.
       
   129 	@return a handle to the remote plugin
       
   130 	*/
       
   131 	virtual TInt OpenInterface(TUid aInterfaceId);
       
   132 
       
   133 	/**
       
   134 	Equivalent to destructor.  Called to destroy plugin.
       
   135 	*/
       
   136 	virtual void Release();
       
   137 	/**
       
   138 	Pass destructor key.
       
   139 	Called on construction so plugin takes responsibility to call REComSession::DestroyedImplementation()
       
   140 	@param aDestructorKey
       
   141 	       The Uid returned by REComSession::CreateImplementationL() or similar
       
   142 	*/
       
   143 	virtual void PassDestructorKey(TUid aDestructorKey);
       
   144 	
       
   145 	/**
       
   146 	Set the target of the custom interface call
       
   147 	@param aTarget
       
   148 	       The DevSound to call the custom interface on.
       
   149 	*/
       
   150 	virtual void SetInterfaceTarget(MMMFDevSoundCustomInterfaceTarget* aTarget);
       
   151 	
       
   152 	/**
       
   153 	Complete construction.
       
   154 	@param aUtility
       
   155 	       The DeMux utility to use
       
   156 	*/
       
   157 	virtual void CompleteConstructL(MMMFDevSoundCustomInterfaceDeMuxUtility* aUtility);
       
   158 
       
   159 	/**
       
   160 	Refresh the current custom interface connections
       
   161 	*/
       
   162 	virtual void RefreshL();
       
   163 
       
   164 	// from MMMFDeMuxInterface
       
   165 	/**
       
   166 	Open the slave
       
   167 	@param aInterface
       
   168 		   The UID of the requested interface
       
   169 	@param aPackageBuf
       
   170 		   A package of data that can be supplied for initialisation
       
   171 	@return the result of the operation
       
   172 	 */
       
   173 	virtual TInt DoOpenSlaveL(TUid aInterface, const TDesC8& aPackageBuf);
       
   174 
       
   175 	/** 
       
   176 	Close the slave
       
   177 	@param aHandle
       
   178 		   The handle of the slave plugin
       
   179 	 */
       
   180 	virtual void DoCloseSlaveL(TInt aHandle);
       
   181 
       
   182 	// original RMessage is supplied so that remote demux plugin can extract necessary details
       
   183 	// using DeMux utility
       
   184 
       
   185 	/**
       
   186 	Relay the synchronous custom command onto the slave
       
   187 	@param aMessage
       
   188 		   The IPC message to be sent to the slave
       
   189 	@return the result of the operation
       
   190 	 */
       
   191 	virtual TInt DoSendSlaveSyncCommandL(const RMmfIpcMessage& aMessage);
       
   192 
       
   193 	/**
       
   194 	Relay the synchronous custom command onto the slave and obtain a result
       
   195 	@param aMessage
       
   196 		   The IPC message to be sent to the slave
       
   197 	@return the result of the operation
       
   198 	 */
       
   199 	virtual TInt DoSendSlaveSyncCommandResultL(const RMmfIpcMessage& aMessage);
       
   200 
       
   201 	/**
       
   202 	Relay an asynchronous command onto the slave
       
   203 	@param aMessage
       
   204 		   The IPC message to be sent to the slave
       
   205 	 */
       
   206 	virtual void DoSendSlaveAsyncCommandL(const RMmfIpcMessage& aMessage);
       
   207 
       
   208 	/**
       
   209 	Relay an asynchronous command onto the slave and obtain a result
       
   210 	@param aMessage
       
   211 		   The IPC message to be sent to the slave@param aMessage
       
   212 	 */
       
   213 	virtual void DoSendSlaveAsyncCommandResultL(const RMmfIpcMessage& aMessage);
       
   214 
       
   215 protected:
       
   216 	~CMMFDevSoundCIBitRateDeMux();
       
   217 	CMMFDevSoundCIBitRateDeMux();
       
   218 
       
   219 	// implementation of bitrate custom interface
       
   220 	void DoGetSupportedBitRatesL(RArray<TInt>& aSupportedBitRates);
       
   221 	void DoCopyBitRateBufferToClientL(const RMmfIpcMessage& aMessage);
       
   222 	TInt DoBitRateL();
       
   223 	void DoSetBitRateL(TInt aBitRate);
       
   224 	
       
   225 protected:
       
   226 	MMMFDevSoundCustomInterfaceDeMuxUtility* iUtility;
       
   227 	MMMFDevSoundCustomInterfaceTarget* iTarget;
       
   228 	MMMFDevSoundCustomInterfaceBitRate* iBitRateInterface;
       
   229 	TUid iKey;
       
   230 	
       
   231 	// array for bitrates
       
   232 	RArray<TInt> iBitRateArray;
       
   233 	};
       
   234 
       
   235 #endif