devsound/devsoundpluginsupport/src/CustomInterfaces/errorconcealmentci.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 error concealment custom interface pair
       
    15 // 
       
    16 //
       
    17 
       
    18 #ifndef ERRORCONCEALMENTCI_H
       
    19 #define ERRORCONCEALMENTCI_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 TMMFDevSoundCIErrorConcealmentIntfcCommands
       
    38 	{
       
    39 	EMMFDevSoundCIErrorConcealmentIntfcConcealErrorForNextBuffer,
       
    40 	EMMFDevSoundCIErrorConcealmentIntfcSetFrameMode,
       
    41 	EMMFDevSoundCIErrorConcealmentIntfcFrameModeRqrdForEC
       
    42 	};
       
    43 
       
    44 
       
    45 /**
       
    46 Implementation of the error concealment custom interface Mux
       
    47 @internalComponent
       
    48 @prototype
       
    49 @file
       
    50 */
       
    51 class CMMFErrorConcealmentIntfcMux : public CBase,
       
    52 									 public MMMFDevSoundCustomInterfaceMuxPlugin,
       
    53 									 public MMMFErrorConcealmentIntfc
       
    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 MErrorConcealmentIntfc
       
   105 	//@see MErrorConcealmentIntfc
       
   106 	virtual TInt ConcealErrorForNextBuffer();
       
   107 	//@see MErrorConcealmentIntfc
       
   108 	virtual TInt SetFrameMode(TBool aFrameModeOn);
       
   109 	//@see MErrorConcealmentIntfc
       
   110 	virtual TInt FrameModeRqrdForEC(TBool& aFrameModeRqrd);
       
   111 
       
   112 protected:
       
   113 	CMMFErrorConcealmentIntfcMux();
       
   114 	~CMMFErrorConcealmentIntfcMux();
       
   115 
       
   116 protected:
       
   117 	TUid iKey;
       
   118 	TInt iRemoteHandle;
       
   119 	MMMFDevSoundCustomInterfaceMuxUtility* iUtility;
       
   120 	};
       
   121 
       
   122 
       
   123 /**
       
   124 Implementation of the G729 Decoder custom interface DeMux
       
   125 @internalComponent
       
   126 @prototype
       
   127 @file
       
   128 */
       
   129 class CMMFErrorConcealmentIntfcDeMux : public CBase,
       
   130 									   public MMMFDevSoundCustomInterfaceDeMuxPlugin
       
   131 	{
       
   132 public:
       
   133 	/**
       
   134 	Instantiate a CMMFErrorConcealmentIntfcDeMux class
       
   135 	@return A pointer to the new class cast to the DeMux plugin mixin
       
   136 	@leave  This method may leave with one of the system-wide error codes.
       
   137 	*/
       
   138 	static MMMFDevSoundCustomInterfaceDeMuxPlugin* NewL();
       
   139 
       
   140 	/**
       
   141 	Attempt to open the interface.
       
   142 	@param  aInterfaceId
       
   143 		    The UID of the interface to open.
       
   144 	@return A handle to the remote plugin
       
   145 	*/
       
   146 	virtual TInt OpenInterface(TUid aInterfaceId);
       
   147 
       
   148 	/**
       
   149 	Equivalent to destructor.  Called to destroy plugin.
       
   150 	*/
       
   151 	virtual void Release();
       
   152 
       
   153 	/**
       
   154 	Pass destructor key.
       
   155 	Called on construction so plugin takes responsibility to call REComSession::DestroyedImplementation()
       
   156 	@param aDestructorKey
       
   157 		   The Uid returned by REComSession::CreateImplementationL() or similar
       
   158 	*/
       
   159 	virtual void PassDestructorKey(TUid aDestructorKey);
       
   160 
       
   161 	/**
       
   162 	Set the target of the custom interface call
       
   163 	@param aTarget
       
   164 		   The DevSound to call the custom interface on.
       
   165 	*/
       
   166 	virtual void SetInterfaceTarget(MMMFDevSoundCustomInterfaceTarget* aTarget);
       
   167 
       
   168 	/**
       
   169 	Complete construction.
       
   170 	@param aUtility
       
   171 		   The DeMux utility to use
       
   172 	@leave This method may leave with one of the system-wide error codes.
       
   173 	*/
       
   174 	virtual void CompleteConstructL(MMMFDevSoundCustomInterfaceDeMuxUtility* aUtility);
       
   175 
       
   176 	/**
       
   177 	Refresh the current custom interface connections
       
   178 	@leave This method may leave with one of the system-wide error codes.
       
   179 	*/
       
   180 	virtual void RefreshL();
       
   181 
       
   182 	// from MMMFDevSoundCustomInterfaceDeMuxPlugin
       
   183 	/**
       
   184 	Open the slave
       
   185 	@param  aInterface
       
   186 		    The UID of the requested interface
       
   187 	@param  aPackageBuf
       
   188 		    A package of data that can be supplied for initialisation
       
   189 	@return The result of the operation
       
   190 	@leave  This method may leave with one of the system-wide error codes.
       
   191 	*/
       
   192 	virtual TInt DoOpenSlaveL(TUid aInterface, const TDesC8& aPackageBuf);
       
   193 
       
   194 	/**
       
   195 	Close the slave
       
   196 	@param aHandle
       
   197 		   The handle of the slave plugin
       
   198 	@leave This method may leave with one of the system-wide error codes.
       
   199 	*/
       
   200 	virtual void DoCloseSlaveL(TInt aHandle);
       
   201 
       
   202 	// original RMessage is supplied so that remote DeMux plugin can extract necessary details
       
   203 	// using DeMux utility
       
   204 
       
   205 	/**
       
   206 	Relay the synchronous custom command onto the slave
       
   207 	@param  aMessage
       
   208 		    The IPC message to be sent to the slave
       
   209 	@return the result of the operation
       
   210 	@leave  This method may leave with one of the system-wide error codes.
       
   211 	*/
       
   212 	virtual TInt DoSendSlaveSyncCommandL(const RMmfIpcMessage& aMessage);
       
   213 
       
   214 	/**
       
   215 	Relay the synchronous custom command onto the slave and obtain a result
       
   216 	@param  aMessage
       
   217 		    The IPC message to be sent to the slave
       
   218 	@return the result of the operation
       
   219 	@leave  This method may leave with one of the system-wide error codes.
       
   220 	*/
       
   221 	virtual TInt DoSendSlaveSyncCommandResultL(const RMmfIpcMessage& aMessage);
       
   222 
       
   223 	/**
       
   224 	Relay an asynchronous command onto the slave
       
   225 	@param aMessage
       
   226 		   The IPC message to be sent to the slave
       
   227 	@leave This method may leave with one of the system-wide error codes.
       
   228 	*/
       
   229 	virtual void DoSendSlaveAsyncCommandL(const RMmfIpcMessage& aMessage);
       
   230 
       
   231 	/**
       
   232 	Relay an asynchronous command onto the slave and obtain a result
       
   233 	@param aMessage
       
   234 		   The IPC message to be sent to the slave@param aMessage
       
   235 	@leave This method may leave with one of the system-wide error codes.
       
   236 	*/
       
   237 	virtual void DoSendSlaveAsyncCommandResultL(const RMmfIpcMessage& aMessage);
       
   238 
       
   239 protected:
       
   240 	~CMMFErrorConcealmentIntfcDeMux();
       
   241 	CMMFErrorConcealmentIntfcDeMux();
       
   242 
       
   243 	// from mirror MErrorConcealmentIntfc method.
       
   244 	TInt DoConcealErrorForNextBufferL();
       
   245 	TInt DoSetFrameModeL(TBool aFrameModeOn);
       
   246 	TInt DoFrameModeRqrdForECL(TBool& aFrameModeRqrd);
       
   247 
       
   248 protected:
       
   249 	MMMFDevSoundCustomInterfaceDeMuxUtility* iUtility;
       
   250 	MMMFDevSoundCustomInterfaceTarget* iTarget;
       
   251 	TUid						iKey;
       
   252 	MMMFErrorConcealmentIntfc*	iInterfaceErrorConcealmentIntfc;
       
   253 	};
       
   254 
       
   255 #endif