os/mm/mmlibs/mmfw/tsrc/mmfunittest/DevSoundTest/a3fcistubextn/a3fcistubextn.h
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
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 A3FCISTUBEXTN_H
sl@0
    17
#define A3FCISTUBEXTN_H
sl@0
    18
sl@0
    19
#include <e32base.h>
sl@0
    20
#include <a3f/mmfdevsoundcustominterfaceextensions.h>
sl@0
    21
sl@0
    22
#include <a3f/maudiocontext.h>
sl@0
    23
#include <a3f/maudiocontextobserver.h>
sl@0
    24
sl@0
    25
#include "testsetvol.h"
sl@0
    26
sl@0
    27
class CSetVol;
sl@0
    28
sl@0
    29
enum TSetVolCommands
sl@0
    30
    {
sl@0
    31
    ETestSetVolIfSetVolCommand,
sl@0
    32
    ETestSetVolIfVolCommand,
sl@0
    33
    };
sl@0
    34
sl@0
    35
/**
sl@0
    36
*
sl@0
    37
* CA3fClientCiStubExtn
sl@0
    38
*
sl@0
    39
* stub version of MDevSoundCIClientExtension 
sl@0
    40
* Always fails to open CIs, but simulates presence of object
sl@0
    41
*/
sl@0
    42
sl@0
    43
class CA3fClientCiStubExtn : public CBase,
sl@0
    44
			   		   		 public MDevSoundCIClientExtension,
sl@0
    45
			   		   		 public MTestSetVolIf
sl@0
    46
			      	 					
sl@0
    47
	{
sl@0
    48
public:
sl@0
    49
	static MDevSoundCIClientExtension* NewL();
sl@0
    50
	~CA3fClientCiStubExtn();
sl@0
    51
sl@0
    52
protected:	
sl@0
    53
	// from MDevSoundCIClientExtension
sl@0
    54
	TInt Setup(MCustomCommand& aCustomCommand);
sl@0
    55
	TInt CustomInterfaceExtension(TUid aUid, TAny*& aInterface);
sl@0
    56
	void Release();
sl@0
    57
	void PassDestructorKey(TUid aDestructorKey);
sl@0
    58
	
sl@0
    59
	// from MTestSetVolIf
sl@0
    60
	TInt SetVol(TInt aVolume);
sl@0
    61
	TInt Vol(TInt aMaxVolume);
sl@0
    62
	
sl@0
    63
protected:
sl@0
    64
	TUid iKey;
sl@0
    65
	MCustomCommand* iCommand; // not owned
sl@0
    66
	HBufC* iDummyBuffer;
sl@0
    67
	};
sl@0
    68
sl@0
    69
sl@0
    70
/**
sl@0
    71
*
sl@0
    72
* CA3fServerCiStubExtn
sl@0
    73
*
sl@0
    74
* stub version of MDevSoundCIServerExtension 
sl@0
    75
* Always fails to open CIs, but simulates presence of object
sl@0
    76
*/
sl@0
    77
sl@0
    78
class CA3fServerCiStubExtn : public CBase,
sl@0
    79
			   		   		 public MDevSoundCIServerExtension
sl@0
    80
			      	 					
sl@0
    81
	{
sl@0
    82
public:
sl@0
    83
	static MDevSoundCIServerExtension* NewL();
sl@0
    84
	~CA3fServerCiStubExtn();
sl@0
    85
sl@0
    86
protected:	
sl@0
    87
	// from MDevSoundCIServerExtension
sl@0
    88
	TInt Setup(MCustomInterface& aInterface);
sl@0
    89
	TInt HandleMessageL(const RMmfIpcMessage& aMessage);
sl@0
    90
	void Release();
sl@0
    91
	void PassDestructorKey(TUid aDestructorKey);
sl@0
    92
	
sl@0
    93
protected:
sl@0
    94
	TUid iKey;
sl@0
    95
	MCustomInterface* iInterface; // not owned
sl@0
    96
	HBufC* iDummyBuffer;
sl@0
    97
	CSetVol* iSetVol;
sl@0
    98
	};
sl@0
    99
	
sl@0
   100
// CAVEAT - for testing only
sl@0
   101
class CSetVol : public CBase,
sl@0
   102
				public MAudioContextObserver
sl@0
   103
	{
sl@0
   104
public:
sl@0
   105
	static CSetVol* NewL(MCustomInterface& aCustomInterface);
sl@0
   106
	~CSetVol();
sl@0
   107
sl@0
   108
	TInt HandleMessageL(const RMmfIpcMessage& aMessage);
sl@0
   109
	
sl@0
   110
	// from MAudioContextObserver
sl@0
   111
	void ContextEvent(TUid aEvent, TInt aError);
sl@0
   112
	
sl@0
   113
private:
sl@0
   114
	CSetVol(MCustomInterface& aCustomInterface);
sl@0
   115
	void ConstructL();
sl@0
   116
	
sl@0
   117
	void UpdateA3fPointers();
sl@0
   118
	void SetVolumeL(TInt aVol);
sl@0
   119
	TInt VolumeL(TInt aMaxVolume);
sl@0
   120
	
sl@0
   121
	MCustomInterface* iInterface; // not owned
sl@0
   122
	MAudioContext* iContext;
sl@0
   123
	MAudioStream* iStream;
sl@0
   124
	MAudioProcessingUnit* iGain;
sl@0
   125
	
sl@0
   126
	CActiveSchedulerWait* iWait;
sl@0
   127
	TInt iError;
sl@0
   128
	};
sl@0
   129
sl@0
   130
sl@0
   131
#endif