devsound/devsoundpluginsupport/src/CustomInterfaces/g711encoderconfigci.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 // Implementation of g711 encoder config custom interface pair
       
    15 // 
       
    16 //
       
    17 
       
    18 #ifndef G711ENCODERCONFIGCI_H
       
    19 #define G711ENCODERCONFIGCI_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 
       
    31 /**
       
    32 Enum to represent the method called by this custom interface
       
    33 @internalComponent
       
    34 @prototype
       
    35 @file
       
    36 */
       
    37 enum TMMFDevSoundCIG711EncoderIntfcCommands
       
    38 	{
       
    39 	EMMFDevSoundCIG711EncoderIntfcSetEncoderMode = 0,
       
    40 	EMMFDevSoundCIG711EncoderIntfcSetVadMode	 = 1,
       
    41 	EMMFDevSoundCIG711EncoderIntfcGetVadMode	 = 2
       
    42 	};
       
    43 
       
    44 
       
    45 /**
       
    46 Implementation of the g711 encoder config custom interface Mux
       
    47 @internalComponent
       
    48 @prototype
       
    49 @file
       
    50 */
       
    51 class CMMFG711EncoderIntfcMux : public CBase,
       
    52 								public MMMFDevSoundCustomInterfaceMuxPlugin,
       
    53 								public MG711EncoderIntfc  
       
    54 	{
       
    55 public:
       
    56 
       
    57 	// from MMMFDevSoundCustomInterfaceMuxPlugin
       
    58 	/**
       
    59 	Attempt to open the interface.
       
    60 	@param  aInterfaceId
       
    61 		    The UID of the interface to open.
       
    62 	@return One of the system wide error codes
       
    63 	*/
       
    64 	virtual TInt OpenInterface(TUid aInterfaceId);
       
    65 
       
    66 	/**
       
    67 	Equivalent to destructor.  Called to destroy plugin.
       
    68 	*/
       
    69 	virtual void Release();
       
    70 
       
    71 	/**
       
    72 	Pass destructor key.
       
    73 	Called on construction so plugin takes responsibility to call REComSession::DestroyedImplementation()
       
    74 	@param aDestructorKey
       
    75 		   The Uid returned by REComSession::CreateImplementationL() or similar
       
    76 	*/
       
    77 	virtual void PassDestructorKey(TUid aDestructorKey);
       
    78 
       
    79 	/**
       
    80 	Complete construction.
       
    81 	Pass additional values from the construction phase, used subsequently by the plugin.
       
    82 	@param aCustomUtility
       
    83 		   The custom interface utility used by the plugin to communicate with the remote
       
    84 		   server side DeMux plugin
       
    85 	@leave This method may leave with one of the system-wide error codes.
       
    86 	*/
       
    87 	virtual void CompleteConstructL(MMMFDevSoundCustomInterfaceMuxUtility* aCustomUtility);
       
    88 
       
    89 	/**
       
    90 	Return the custom interface
       
    91 	@param  aInterfaceId
       
    92 		    The UID of the required custom interface
       
    93 	@return The custom interface supported by this plugin
       
    94 	*/
       
    95 	virtual TAny* CustomInterface(TUid aInterfaceId);
       
    96 
       
    97 	/**
       
    98 	Instantiate a CI Mux class
       
    99 	@return The pointer to the new class, cast to the Mux plugin mixin
       
   100 	@leave  This method may leave with one of the system-wide error codes.
       
   101 	*/
       
   102 	static MMMFDevSoundCustomInterfaceMuxPlugin* NewL();
       
   103 
       
   104 	// from MG711EncoderIntfc
       
   105 	//@see MG711EncoderIntfc
       
   106 	virtual TInt SetEncoderMode (TEncodeMode aEncodeMode);
       
   107 	//@see MG711EncoderIntfc
       
   108 	virtual TInt SetVadMode (TBool aVadModeOn);
       
   109 	//@see MG711EncoderIntfc
       
   110 	virtual TInt GetVadMode (TBool& aVadModeOn);
       
   111 
       
   112 
       
   113 protected:
       
   114 	CMMFG711EncoderIntfcMux();
       
   115 	~CMMFG711EncoderIntfcMux();
       
   116 
       
   117 protected:
       
   118 	TUid iKey;
       
   119 	TInt iRemoteHandle;
       
   120 	MMMFDevSoundCustomInterfaceMuxUtility* iUtility;
       
   121 	};
       
   122 
       
   123 
       
   124 /**
       
   125 Implementation of the G711 Decoder config custom interface DeMux
       
   126 @internalComponent
       
   127 @prototype
       
   128 @file
       
   129 */
       
   130 class CMMFG711EncoderIntfcDeMux : public CBase,
       
   131 								  public MMMFDevSoundCustomInterfaceDeMuxPlugin
       
   132 	{
       
   133 public:
       
   134 	/**
       
   135 	Instantiate a CMMFG711EncoderIntfcDeMux class
       
   136 	@return A pointer to the new class cast to the DeMux plugin mixin
       
   137 	@leave  This method may leave with one of the system-wide error codes.
       
   138 	*/
       
   139 	static MMMFDevSoundCustomInterfaceDeMuxPlugin* NewL();
       
   140 
       
   141 	/**
       
   142 	Attempt to open the interface.
       
   143 	@param  aInterfaceId
       
   144 		    The UID of the interface to open.
       
   145 	@return A handle to the remote plugin
       
   146 	*/
       
   147 	virtual TInt OpenInterface(TUid aInterfaceId);
       
   148 
       
   149 	/**
       
   150 	Equivalent to destructor.  Called to destroy plugin.
       
   151 	*/
       
   152 	virtual void Release();
       
   153 
       
   154 	/**
       
   155 	Pass destructor key.
       
   156 	Called on construction so plugin takes responsibility to call REComSession::DestroyedImplementation()
       
   157 	@param aDestructorKey
       
   158 		   The Uid returned by REComSession::CreateImplementationL() or similar
       
   159 	*/
       
   160 	virtual void PassDestructorKey(TUid aDestructorKey);
       
   161 
       
   162 	/**
       
   163 	Set the target of the custom interface call
       
   164 	@param aTarget
       
   165 		   The DevSound to call the custom interface on.
       
   166 	*/
       
   167 	virtual void SetInterfaceTarget(MMMFDevSoundCustomInterfaceTarget* aTarget);
       
   168 
       
   169 	/**
       
   170 	Complete construction.
       
   171 	@param aUtility
       
   172 		   The DeMux utility to use
       
   173 	@leave This method may leave with one of the system-wide error codes.
       
   174 	*/
       
   175 	virtual void CompleteConstructL(MMMFDevSoundCustomInterfaceDeMuxUtility* aUtility);
       
   176 
       
   177 	/**
       
   178 	Refresh the current custom interface connections
       
   179 	@leave This method may leave with one of the system-wide error codes.
       
   180 	*/
       
   181 	virtual void RefreshL();
       
   182 
       
   183 	// from MMMFDevSoundCustomInterfaceDeMuxPlugin
       
   184 	/**
       
   185 	Open the slave
       
   186 	@param  aInterface
       
   187 		    The UID of the requested interface
       
   188 	@param  aPackageBuf
       
   189 		    A package of data that can be supplied for initialisation
       
   190 	@return The result of the operation
       
   191 	@leave  This method may leave with one of the system-wide error codes.
       
   192 	*/
       
   193 	virtual TInt DoOpenSlaveL(TUid aInterface, const TDesC8& aPackageBuf);
       
   194 
       
   195 	/**
       
   196 	Close the slave
       
   197 	@param aHandle
       
   198 		   The handle of the slave plugin
       
   199 	@leave This method may leave with one of the system-wide error codes.
       
   200 	*/
       
   201 	virtual void DoCloseSlaveL(TInt aHandle);
       
   202 
       
   203 	/**
       
   204 	Relay the synchronous custom command onto the slave
       
   205 	@param  aMessage
       
   206 		    The IPC message to be sent to the slave
       
   207 	@return the result of the operation
       
   208 	@leave  This method may leave with one of the system-wide error codes.
       
   209 	*/
       
   210 	virtual TInt DoSendSlaveSyncCommandL(const RMmfIpcMessage& aMessage);
       
   211 
       
   212 	/**
       
   213 	Relay the synchronous custom command onto the slave and obtain a result
       
   214 	@param  aMessage
       
   215 		    The IPC message to be sent to the slave
       
   216 	@return the result of the operation
       
   217 	@leave  This method may leave with one of the system-wide error codes.
       
   218 	*/
       
   219 	virtual TInt DoSendSlaveSyncCommandResultL(const RMmfIpcMessage& aMessage);
       
   220 
       
   221 	/**
       
   222 	Relay an asynchronous command onto the slave
       
   223 	@param aMessage
       
   224 		   The IPC message to be sent to the slave
       
   225 	@leave This method may leave with one of the system-wide error codes.
       
   226 	*/
       
   227 	virtual void DoSendSlaveAsyncCommandL(const RMmfIpcMessage& aMessage);
       
   228 
       
   229 	/**
       
   230 	Relay an asynchronous command onto the slave and obtain a result
       
   231 	@param aMessage
       
   232 		   The IPC message to be sent to the slave@param aMessage
       
   233 	@leave This method may leave with one of the system-wide error codes.
       
   234 	*/
       
   235 	virtual void DoSendSlaveAsyncCommandResultL(const RMmfIpcMessage& aMessage);
       
   236 
       
   237 protected:
       
   238 	~CMMFG711EncoderIntfcDeMux();
       
   239 	CMMFG711EncoderIntfcDeMux();
       
   240 
       
   241 	// from mirror MG711EncoderIntfc method.
       
   242 	TInt DoSetEncoderMode (MG711EncoderIntfc::TEncodeMode aEncodeMode);
       
   243 	TInt DoSetVadMode (TBool aVadModeOn);
       
   244 	TInt DoGetVadMode (TBool& aVadModeOn);
       
   245 	
       
   246 protected:
       
   247 	MMMFDevSoundCustomInterfaceDeMuxUtility* iUtility;
       
   248 	MMMFDevSoundCustomInterfaceTarget* iTarget;
       
   249 	TUid				iKey;
       
   250 	MG711EncoderIntfc*	iInterfaceG711EncoderIntfc; 
       
   251 	};
       
   252 
       
   253 #endif