sl@0: // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // sl@0: sl@0: #ifndef MMFDEVSOUNDCIMUXUTILITY_H sl@0: #define MMFDEVSOUNDCIMUXUTILITY_H sl@0: sl@0: #include sl@0: #include sl@0: #include sl@0: #include "mmfaudioclientserver.h" sl@0: #include sl@0: sl@0: sl@0: /** sl@0: * @internalTechnology sl@0: * @file sl@0: */ sl@0: sl@0: class CMMFDevSoundCIMuxUtility; sl@0: class TA3FCustomInterfaceCommand; sl@0: NONSHARABLE_CLASS( CMMFDevSoundCIMuxUtility ) : public CBase, sl@0: public MMMFDevSoundCustomInterfaceMuxUtility sl@0: { sl@0: public: sl@0: enum TMMFDevSoundCustomCommand sl@0: { sl@0: EMMFDevSoundCustomCommandCIOpenSlave, sl@0: EMMFDevSoundCustomCommandCICloseSlave, sl@0: EMMFDevSoundCustomCommandCISendSlaveSyncCommand, sl@0: EMMFDevSoundCustomCommandCISendSlaveSyncCommandResult, sl@0: EMMFDevSoundCustomCommandCISendSlaveAsyncCommand, sl@0: EMMFDevSoundCustomCommandCISendSlaveAsyncCommandResult sl@0: }; sl@0: sl@0: /* sl@0: * internal class used for Asynchronous Custom Command message passing from CI Mux to Demux. sl@0: */ sl@0: sl@0: NONSHARABLE_CLASS(CAsyncCommandCleanup): public CActive sl@0: { sl@0: sl@0: public: sl@0: sl@0: static CAsyncCommandCleanup* NewL(CMMFDevSoundCIMuxUtility* aMuxUtility,MMMFDevSoundCustomInterfaceChannel* aCustomChannel); sl@0: ~CAsyncCommandCleanup(); sl@0: void AsyncCustomCommand(CMMFDevSoundCIMuxUtility::TMMFDevSoundCustomCommand aType,TMMFDevSoundCustomInterfaceCommandPackage& aComPackage, TRequestStatus& aStatus, const TDesC8& aPackageBuf, TDes8* aResultBuf); sl@0: sl@0: private: sl@0: void ConstructL(); sl@0: void RunL(); sl@0: void DoCancel(); sl@0: CAsyncCommandCleanup(CMMFDevSoundCIMuxUtility* aMuxUtility,MMMFDevSoundCustomInterfaceChannel* aCustomChannel); sl@0: sl@0: public: sl@0: TPckgBuf* iCommandBuffer; sl@0: sl@0: private: sl@0: sl@0: CMMFDevSoundCIMuxUtility* iMuxUtility; sl@0: MMMFDevSoundCustomInterfaceChannel* iCustomChannel; sl@0: TRequestStatus* iClientRequestStatus; sl@0: }; sl@0: sl@0: public: sl@0: static CMMFDevSoundCIMuxUtility* NewL(MMMFDevSoundCustomInterfaceChannel* aCustomChannel); sl@0: virtual ~CMMFDevSoundCIMuxUtility(); sl@0: void ConstructL(); sl@0: sl@0: // create a custom interface Mux implementation. sl@0: MMMFDevSoundCustomInterfaceMuxPlugin* CreateCustomInterfaceMuxL(TUid aInterfaceId); sl@0: sl@0: // from MMMFDevSoundCustomInterfaceMux interface. sl@0: virtual TInt OpenSlave(TUid, const TDesC8& aPackageBuf); sl@0: virtual void CloseSlave(TInt aHandle); sl@0: virtual TInt SendSlaveSyncCommand(TInt aHandle, TInt aCommand, const TDesC8& aPackageBuf); sl@0: virtual TInt SendSlaveSyncCommandResult(TInt aHandle, TInt aCommand, const TDesC8& aPackageBuf, TDes8& aResultBuf); sl@0: virtual void SendSlaveAsyncCommand(TMMFDevSoundCustomInterfaceCommandPackage& aComPackage, TRequestStatus& aStatus, const TDesC8& aPackageBuf); sl@0: virtual void SendSlaveAsyncCommandResult(TMMFDevSoundCustomInterfaceCommandPackage& aComPackage, TRequestStatus& aStatus, const TDesC8& aPackageBuf, TDes8& aResultBuf); sl@0: sl@0: void RemoveAsyncCommand(CAsyncCommandCleanup* aAsyncCustomCommandCleanup); sl@0: private: sl@0: CMMFDevSoundCIMuxUtility(MMMFDevSoundCustomInterfaceChannel* aCustomChannel); sl@0: // Not owned. sl@0: MMMFDevSoundCustomInterfaceChannel* iCustomChannel; sl@0: RPointerArray iAsyncCustomCommandCleanup; sl@0: }; sl@0: sl@0: sl@0: /* sl@0: * internal class used to pass custom command & custom command type from CI Mux to DeMux. sl@0: */ sl@0: class TA3FCustomInterfaceCommand sl@0: { sl@0: public: sl@0: // Custom Interface command (meaning depends on CI in use) sl@0: TInt iCommand; sl@0: // Internal slave command type. sl@0: CMMFDevSoundCIMuxUtility::TMMFDevSoundCustomCommand iType; sl@0: // CI handle (equates to an offset into array of open CIs for most command types) sl@0: TInt iHandle; sl@0: }; sl@0: sl@0: sl@0: #endif