os/mm/devsound/a3fdevsound/src/mmfdevsound/MmfDevSoundCIMuxUtility.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/mm/devsound/a3fdevsound/src/mmfdevsound/MmfDevSoundCIMuxUtility.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,116 @@
     1.4 +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +//
    1.18 +
    1.19 +#ifndef MMFDEVSOUNDCIMUXUTILITY_H
    1.20 +#define MMFDEVSOUNDCIMUXUTILITY_H
    1.21 +
    1.22 +#include <f32file.h>
    1.23 +#include <e32math.h>
    1.24 +#include <s32mem.h> 
    1.25 +#include "mmfaudioclientserver.h"
    1.26 +#include <mmf/server/mmfdevsoundcustominterface.h>
    1.27 +
    1.28 +
    1.29 +/**
    1.30 +* @internalTechnology
    1.31 +* @file
    1.32 +*/
    1.33 +
    1.34 +class CMMFDevSoundCIMuxUtility;
    1.35 +class TA3FCustomInterfaceCommand;
    1.36 +NONSHARABLE_CLASS( CMMFDevSoundCIMuxUtility ) : public CBase, 
    1.37 +												public MMMFDevSoundCustomInterfaceMuxUtility
    1.38 +	{
    1.39 +public:
    1.40 +	enum TMMFDevSoundCustomCommand
    1.41 +		{
    1.42 +		EMMFDevSoundCustomCommandCIOpenSlave,
    1.43 +		EMMFDevSoundCustomCommandCICloseSlave,
    1.44 +		EMMFDevSoundCustomCommandCISendSlaveSyncCommand,
    1.45 +		EMMFDevSoundCustomCommandCISendSlaveSyncCommandResult,
    1.46 +		EMMFDevSoundCustomCommandCISendSlaveAsyncCommand,
    1.47 +		EMMFDevSoundCustomCommandCISendSlaveAsyncCommandResult
    1.48 +		};
    1.49 +		
    1.50 +		/*
    1.51 +	* internal class used for Asynchronous Custom Command message passing from CI Mux to Demux.
    1.52 +	*/
    1.53 +
    1.54 +	NONSHARABLE_CLASS(CAsyncCommandCleanup): public CActive
    1.55 +		{
    1.56 +
    1.57 +	public:
    1.58 +			
    1.59 +		static CAsyncCommandCleanup* NewL(CMMFDevSoundCIMuxUtility* aMuxUtility,MMMFDevSoundCustomInterfaceChannel* aCustomChannel);
    1.60 +		~CAsyncCommandCleanup();
    1.61 +		void AsyncCustomCommand(CMMFDevSoundCIMuxUtility::TMMFDevSoundCustomCommand aType,TMMFDevSoundCustomInterfaceCommandPackage& aComPackage, TRequestStatus& aStatus, const TDesC8& aPackageBuf, TDes8* aResultBuf);
    1.62 +
    1.63 +	private:
    1.64 +		void ConstructL();
    1.65 +		void RunL();
    1.66 +		void DoCancel();
    1.67 +		CAsyncCommandCleanup(CMMFDevSoundCIMuxUtility* aMuxUtility,MMMFDevSoundCustomInterfaceChannel* aCustomChannel);
    1.68 +
    1.69 +	public:
    1.70 +		TPckgBuf<TA3FCustomInterfaceCommand>* iCommandBuffer;
    1.71 +
    1.72 +	private:
    1.73 +
    1.74 +		CMMFDevSoundCIMuxUtility* iMuxUtility;
    1.75 +		MMMFDevSoundCustomInterfaceChannel* iCustomChannel;		
    1.76 +		TRequestStatus* iClientRequestStatus;
    1.77 +		};
    1.78 +
    1.79 +public:
    1.80 +	static CMMFDevSoundCIMuxUtility* NewL(MMMFDevSoundCustomInterfaceChannel* aCustomChannel);
    1.81 +	virtual ~CMMFDevSoundCIMuxUtility();
    1.82 +	void ConstructL();
    1.83 +
    1.84 +	// create a custom interface Mux implementation.
    1.85 +	MMMFDevSoundCustomInterfaceMuxPlugin* CreateCustomInterfaceMuxL(TUid aInterfaceId);
    1.86 +	
    1.87 +	// from MMMFDevSoundCustomInterfaceMux interface.
    1.88 +	virtual TInt OpenSlave(TUid, const TDesC8& aPackageBuf);
    1.89 +	virtual void CloseSlave(TInt aHandle);
    1.90 +	virtual TInt SendSlaveSyncCommand(TInt aHandle, TInt aCommand, const TDesC8& aPackageBuf);
    1.91 +	virtual TInt SendSlaveSyncCommandResult(TInt aHandle, TInt aCommand, const TDesC8& aPackageBuf, TDes8& aResultBuf); 
    1.92 +	virtual void SendSlaveAsyncCommand(TMMFDevSoundCustomInterfaceCommandPackage& aComPackage, TRequestStatus& aStatus, const TDesC8& aPackageBuf);
    1.93 +	virtual void SendSlaveAsyncCommandResult(TMMFDevSoundCustomInterfaceCommandPackage& aComPackage, TRequestStatus& aStatus, const TDesC8& aPackageBuf, TDes8& aResultBuf);	
    1.94 +	
    1.95 +	void RemoveAsyncCommand(CAsyncCommandCleanup* aAsyncCustomCommandCleanup);
    1.96 +private:
    1.97 +	CMMFDevSoundCIMuxUtility(MMMFDevSoundCustomInterfaceChannel* aCustomChannel);
    1.98 +	// Not owned.
    1.99 +	MMMFDevSoundCustomInterfaceChannel* iCustomChannel;
   1.100 +	RPointerArray <CAsyncCommandCleanup> iAsyncCustomCommandCleanup;
   1.101 +	};
   1.102 +
   1.103 +
   1.104 +/*
   1.105 +* internal class used to pass custom command & custom command type from CI Mux to DeMux.
   1.106 +*/
   1.107 +class TA3FCustomInterfaceCommand
   1.108 +	{
   1.109 +public:
   1.110 +	// Custom Interface command (meaning depends on CI in use)
   1.111 +	TInt iCommand;
   1.112 +	// Internal slave command type.
   1.113 +	CMMFDevSoundCIMuxUtility::TMMFDevSoundCustomCommand iType;
   1.114 +	// CI handle (equates to an offset into array of open CIs for most command types)
   1.115 +	TInt iHandle;
   1.116 +	};
   1.117 +	
   1.118 +
   1.119 +#endif