os/mm/devsound/a3fdevsound/src/mmfdevsound/MmfDevSoundCIMuxUtility.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
//
sl@0
    15
sl@0
    16
#ifndef MMFDEVSOUNDCIMUXUTILITY_H
sl@0
    17
#define MMFDEVSOUNDCIMUXUTILITY_H
sl@0
    18
sl@0
    19
#include <f32file.h>
sl@0
    20
#include <e32math.h>
sl@0
    21
#include <s32mem.h> 
sl@0
    22
#include "mmfaudioclientserver.h"
sl@0
    23
#include <mmf/server/mmfdevsoundcustominterface.h>
sl@0
    24
sl@0
    25
sl@0
    26
/**
sl@0
    27
* @internalTechnology
sl@0
    28
* @file
sl@0
    29
*/
sl@0
    30
sl@0
    31
class CMMFDevSoundCIMuxUtility;
sl@0
    32
class TA3FCustomInterfaceCommand;
sl@0
    33
NONSHARABLE_CLASS( CMMFDevSoundCIMuxUtility ) : public CBase, 
sl@0
    34
												public MMMFDevSoundCustomInterfaceMuxUtility
sl@0
    35
	{
sl@0
    36
public:
sl@0
    37
	enum TMMFDevSoundCustomCommand
sl@0
    38
		{
sl@0
    39
		EMMFDevSoundCustomCommandCIOpenSlave,
sl@0
    40
		EMMFDevSoundCustomCommandCICloseSlave,
sl@0
    41
		EMMFDevSoundCustomCommandCISendSlaveSyncCommand,
sl@0
    42
		EMMFDevSoundCustomCommandCISendSlaveSyncCommandResult,
sl@0
    43
		EMMFDevSoundCustomCommandCISendSlaveAsyncCommand,
sl@0
    44
		EMMFDevSoundCustomCommandCISendSlaveAsyncCommandResult
sl@0
    45
		};
sl@0
    46
		
sl@0
    47
		/*
sl@0
    48
	* internal class used for Asynchronous Custom Command message passing from CI Mux to Demux.
sl@0
    49
	*/
sl@0
    50
sl@0
    51
	NONSHARABLE_CLASS(CAsyncCommandCleanup): public CActive
sl@0
    52
		{
sl@0
    53
sl@0
    54
	public:
sl@0
    55
			
sl@0
    56
		static CAsyncCommandCleanup* NewL(CMMFDevSoundCIMuxUtility* aMuxUtility,MMMFDevSoundCustomInterfaceChannel* aCustomChannel);
sl@0
    57
		~CAsyncCommandCleanup();
sl@0
    58
		void AsyncCustomCommand(CMMFDevSoundCIMuxUtility::TMMFDevSoundCustomCommand aType,TMMFDevSoundCustomInterfaceCommandPackage& aComPackage, TRequestStatus& aStatus, const TDesC8& aPackageBuf, TDes8* aResultBuf);
sl@0
    59
sl@0
    60
	private:
sl@0
    61
		void ConstructL();
sl@0
    62
		void RunL();
sl@0
    63
		void DoCancel();
sl@0
    64
		CAsyncCommandCleanup(CMMFDevSoundCIMuxUtility* aMuxUtility,MMMFDevSoundCustomInterfaceChannel* aCustomChannel);
sl@0
    65
sl@0
    66
	public:
sl@0
    67
		TPckgBuf<TA3FCustomInterfaceCommand>* iCommandBuffer;
sl@0
    68
sl@0
    69
	private:
sl@0
    70
sl@0
    71
		CMMFDevSoundCIMuxUtility* iMuxUtility;
sl@0
    72
		MMMFDevSoundCustomInterfaceChannel* iCustomChannel;		
sl@0
    73
		TRequestStatus* iClientRequestStatus;
sl@0
    74
		};
sl@0
    75
sl@0
    76
public:
sl@0
    77
	static CMMFDevSoundCIMuxUtility* NewL(MMMFDevSoundCustomInterfaceChannel* aCustomChannel);
sl@0
    78
	virtual ~CMMFDevSoundCIMuxUtility();
sl@0
    79
	void ConstructL();
sl@0
    80
sl@0
    81
	// create a custom interface Mux implementation.
sl@0
    82
	MMMFDevSoundCustomInterfaceMuxPlugin* CreateCustomInterfaceMuxL(TUid aInterfaceId);
sl@0
    83
	
sl@0
    84
	// from MMMFDevSoundCustomInterfaceMux interface.
sl@0
    85
	virtual TInt OpenSlave(TUid, const TDesC8& aPackageBuf);
sl@0
    86
	virtual void CloseSlave(TInt aHandle);
sl@0
    87
	virtual TInt SendSlaveSyncCommand(TInt aHandle, TInt aCommand, const TDesC8& aPackageBuf);
sl@0
    88
	virtual TInt SendSlaveSyncCommandResult(TInt aHandle, TInt aCommand, const TDesC8& aPackageBuf, TDes8& aResultBuf); 
sl@0
    89
	virtual void SendSlaveAsyncCommand(TMMFDevSoundCustomInterfaceCommandPackage& aComPackage, TRequestStatus& aStatus, const TDesC8& aPackageBuf);
sl@0
    90
	virtual void SendSlaveAsyncCommandResult(TMMFDevSoundCustomInterfaceCommandPackage& aComPackage, TRequestStatus& aStatus, const TDesC8& aPackageBuf, TDes8& aResultBuf);	
sl@0
    91
	
sl@0
    92
	void RemoveAsyncCommand(CAsyncCommandCleanup* aAsyncCustomCommandCleanup);
sl@0
    93
private:
sl@0
    94
	CMMFDevSoundCIMuxUtility(MMMFDevSoundCustomInterfaceChannel* aCustomChannel);
sl@0
    95
	// Not owned.
sl@0
    96
	MMMFDevSoundCustomInterfaceChannel* iCustomChannel;
sl@0
    97
	RPointerArray <CAsyncCommandCleanup> iAsyncCustomCommandCleanup;
sl@0
    98
	};
sl@0
    99
sl@0
   100
sl@0
   101
/*
sl@0
   102
* internal class used to pass custom command & custom command type from CI Mux to DeMux.
sl@0
   103
*/
sl@0
   104
class TA3FCustomInterfaceCommand
sl@0
   105
	{
sl@0
   106
public:
sl@0
   107
	// Custom Interface command (meaning depends on CI in use)
sl@0
   108
	TInt iCommand;
sl@0
   109
	// Internal slave command type.
sl@0
   110
	CMMFDevSoundCIMuxUtility::TMMFDevSoundCustomCommand iType;
sl@0
   111
	// CI handle (equates to an offset into array of open CIs for most command types)
sl@0
   112
	TInt iHandle;
sl@0
   113
	};
sl@0
   114
	
sl@0
   115
sl@0
   116
#endif