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