os/mm/mmlibs/mmfw/tsrc/mmfunittest/DevSoundTest/CIPlugins/src/MMFDevSoundCIMuxDeMuxPluginImp.h
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
     1 // Copyright (c) 2008-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 // Implementation of aac decoder config custom interface pair
    15 // 
    16 //
    17 
    18 #ifndef AACDECODERCONFIGCI_H
    19 #define AACDECODERCONFIGCI_H
    20 
    21 #include <e32base.h>
    22 #include <mmf/common/mmfipc.h>
    23 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
    24 #include <mmf/common/mmfipcserver.h>
    25 #endif
    26 #include <mmf/server/mmfdevsoundcustominterface.h>
    27 #include <mmf/server/mmfdevsoundcustomcommands.h>
    28 #include <mmf/server/devsoundstandardcustominterfaces.h>
    29 #include <mmf/plugin/mmfdevsoundcustominterface.hrh>
    30 #include "devsoundciutestdevices.hrh"
    31 
    32 /**
    33 Enum to represent the method called by this custom interface
    34 @internalComponent
    35 @prototype
    36 @file
    37 */
    38 enum TMMFDevSoundCIMuxDemuxCommands
    39 	{
    40 	EMMFDevSoundCIMuxDemuxCauseHeapFail = 0,
    41 	EMMFDevSoundCIMuxDemuxStopHeapFail,
    42 	EMMFDevSoundCIMuxDemuxCheckHeapFail
    43 	};
    44 
    45 class MMMFDevSoundCIMuxPluginInterface
    46 	{
    47 public:
    48 	virtual TInt DevSoundCIMuxCauseHeapFail(TInt aFailCount) =0;
    49 	virtual TInt DevSoundCIMuxStopHeapFail() =0;
    50 	virtual TInt DevSoundCIMuxCheckHeapFail() =0;
    51 	};
    52 	
    53 
    54 /**
    55 Implementation of the DevSound Interface Mux
    56 @internalComponent
    57 @prototype
    58 @file
    59 */
    60 class CMMFDevSoundCIMuxPluginImp : public CBase,
    61 								public MMMFDevSoundCustomInterfaceMuxPlugin,
    62 								public MMMFDevSoundCIMuxPluginInterface
    63 	{
    64 public:
    65 
    66 	// from MMMFDevSoundCustomInterfaceMuxPlugin
    67 	/**
    68 	Attempt to open the interface.
    69 	@param  aInterfaceId
    70 		    The UID of the interface to open.
    71 	@return one of the system wide error codes
    72 	*/
    73 	virtual TInt OpenInterface(TUid aInterfaceId);
    74 
    75 	/**
    76 	Equivalent to destructor.  Called to destroy plugin.
    77 	*/
    78 	virtual void Release();
    79 
    80 	/**
    81 	Pass destructor key.
    82 	Called on construction so plugin takes responsibility to call REComSession::DestroyedImplementation()
    83 	@param aDestructorKey
    84 		   The Uid returned by REComSession::CreateImplementationL() or similar
    85 	*/
    86 	virtual void PassDestructorKey(TUid aDestructorKey);
    87 
    88 	/**
    89 	Complete construction.
    90 	Pass additional values from the construction phase, used subsequently by the plugin.
    91 	@param aCustomUtility
    92 		   The custom interface utility used by the plugin to communicate with the remote
    93 		   server side DeMux plugin
    94 	@leave This method may leave with one of the system-wide error codes.
    95 	*/
    96 	virtual void CompleteConstructL(MMMFDevSoundCustomInterfaceMuxUtility* aCustomUtility);
    97 
    98 	/**
    99 	Return the custom interface
   100 	@param  aInterfaceId
   101 		    The UID of the required custom interface
   102 	@return the custom interface supported by this plugin
   103 	*/
   104 	virtual TAny* CustomInterface(TUid aInterfaceId);
   105 
   106 	/**
   107 	Instantiate a CI Mux class
   108 	@return the pointer to the new class, cast to the Mux plugin mixin
   109 	@leave  This method may leave with one of the system-wide error codes.
   110 	*/
   111 	static MMMFDevSoundCustomInterfaceMuxPlugin* NewL();
   112 
   113 	//Specific public method calls for this mux
   114 	TInt DevSoundCIMuxStopHeapFail();
   115 	TInt DevSoundCIMuxCauseHeapFail(TInt aFailCount);
   116 	TInt DevSoundCIMuxCheckHeapFail();
   117 	
   118 protected:
   119 	CMMFDevSoundCIMuxPluginImp();
   120 	~CMMFDevSoundCIMuxPluginImp();
   121 
   122 protected:
   123 	TUid iKey;
   124 	TInt iRemoteHandle;
   125 	MMMFDevSoundCustomInterfaceMuxUtility* iUtility;
   126 	};
   127 
   128 
   129 /**
   130 Implementation of the DevSound custom interface DeMux
   131 @internalComponent
   132 @prototype
   133 @file
   134 */
   135 class CMMFDevSoundCIDemuxPluginImp : public CBase,
   136 								  public MMMFDevSoundCustomInterfaceDeMuxPlugin
   137 	{
   138 public:
   139 	/**
   140 	Instantiate a CMMFAacDecoderConfigDeMux class
   141 	@return a pointer to the new class cast to the DeMux plugin mixin
   142 	@leave  This method may leave with one of the system-wide error codes.
   143 	*/
   144 	static MMMFDevSoundCustomInterfaceDeMuxPlugin* NewL();
   145 		
   146 	/**
   147 	Attempt to open the interface.
   148 	@param  aInterfaceId
   149 		    The UID of the interface to open.
   150 	@return a handle to the remote plugin
   151 	*/
   152 	virtual TInt OpenInterface(TUid aInterfaceId);
   153 
   154 	/**
   155 	Equivalent to destructor.  Called to destroy plugin.
   156 	*/
   157 	virtual void Release();
   158 
   159 	/**
   160 	Pass destructor key.
   161 	Called on construction so plugin takes responsibility to call REComSession::DestroyedImplementation()
   162 	@param aDestructorKey
   163 		   The Uid returned by REComSession::CreateImplementationL() or similar
   164 	*/
   165 	virtual void PassDestructorKey(TUid aDestructorKey);
   166 
   167 	/**
   168 	Set the target of the custom interface call
   169 	@param aTarget
   170 		   The DevSound to call the custom interface on.
   171 	*/
   172 	virtual void SetInterfaceTarget(MMMFDevSoundCustomInterfaceTarget* aTarget);
   173 
   174 	/**
   175 	Complete construction.
   176 	@param aUtility
   177 		   The DeMux utility to use
   178 	@leave This method may leave with one of the system-wide error codes.
   179 	*/
   180 	virtual void CompleteConstructL(MMMFDevSoundCustomInterfaceDeMuxUtility* aUtility);
   181 
   182 	/**
   183 	Refresh the current custom interface connections
   184 	@leave This method may leave with one of the system-wide error codes.
   185 	*/
   186 	virtual void RefreshL();
   187 
   188 	// from MMMFDevSoundCustomInterfaceDeMuxPlugin
   189 	/**
   190 	Open the slave
   191 	@param  aInterface
   192 		    The UID of the requested interface
   193 	@param  aPackageBuf
   194 		    A package of data that can be supplied for initialisation
   195 	@return the result of the operation
   196 	@leave  This method may leave with one of the system-wide error codes.
   197 	*/
   198 	virtual TInt DoOpenSlaveL(TUid aInterface, const TDesC8& aPackageBuf);
   199 
   200 	/**
   201 	Close the slave
   202 	@param aHandle
   203 		   The handle of the slave plugin
   204 	@leave This method may leave with one of the system-wide error codes.
   205 	*/
   206 	virtual void DoCloseSlaveL(TInt aHandle);
   207 
   208 	// original RMessage is supplied so that remote DeMux plugin can extract necessary details
   209 	// using DeMux utility
   210 
   211 	/**
   212 	Relay the synchronous custom command onto the slave
   213 	@param  aMessage
   214 		    The IPC message to be sent to the slave
   215 	@return the result of the operation
   216 	@leave  This method may leave with one of the system-wide error codes.
   217 	*/
   218 	virtual TInt DoSendSlaveSyncCommandL(const RMmfIpcMessage& aMessage);
   219 
   220 	/**
   221 	Relay the synchronous custom command onto the slave and obtain a result
   222 	@param  aMessage
   223 		    The IPC message to be sent to the slave
   224 	@return the result of the operation
   225 	@leave  This method may leave with one of the system-wide error codes.
   226 	*/
   227 	virtual TInt DoSendSlaveSyncCommandResultL(const RMmfIpcMessage& aMessage);
   228 
   229 	/**
   230 	Relay an asynchronous command onto the slave
   231 	@param aMessage
   232 		   The IPC message to be sent to the slave
   233 	@leave This method may leave with one of the system-wide error codes.
   234 	*/
   235 	virtual void DoSendSlaveAsyncCommandL(const RMmfIpcMessage& aMessage);
   236 
   237 	/**
   238 	Relay an asynchronous command onto the slave and obtain a result
   239 	@param aMessage
   240 		   The IPC message to be sent to the slave@param aMessage
   241 	@leave This method may leave with one of the system-wide error codes.
   242 	*/
   243 	virtual void DoSendSlaveAsyncCommandResultL(const RMmfIpcMessage& aMessage);
   244 
   245 protected:
   246 	//Specific public method calls for this demux
   247 	~CMMFDevSoundCIDemuxPluginImp();
   248 	CMMFDevSoundCIDemuxPluginImp();
   249 
   250 protected:
   251 	MMMFDevSoundCustomInterfaceDeMuxUtility* iUtility;
   252 	MMMFDevSoundCustomInterfaceTarget*		 iTarget;
   253 	TUid									 iKey;
   254 	};
   255 
   256 #endif