os/mm/mmlibs/mmfw/tsrc/mmfintegrationtest/SDevSound/SDSCapTestServer/src/CapTestStep.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) 2004-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 __CAPTESTSTEP_H__
    17 #define __CAPTESTSTEP_H__
    18 
    19 #include <mdaaudiosampleeditor.h>
    20 #include <simulprocserver.h>
    21 #include <mmf/server/sounddevice.h>
    22 
    23 const TInt KDevSoundPriorityLow=0;
    24 const TInt KDevSoundPriorityHigh=100;
    25 
    26 /**
    27  *
    28  * CActiveListener provides the asynchronous operation
    29  * of an active object
    30  *
    31  * @lib "TSI_MMF_SDEVSOUND_SUITE.lib"
    32  *
    33  *
    34  */
    35 class CActiveListener : public CActive
    36 	{
    37 public:
    38 	CActiveListener() : CActive(CActive::EPriorityStandard) 
    39 		{ 
    40 		CActiveScheduler::Add(this);
    41 		}
    42 	void InitialiseActiveListener()
    43 		{
    44 		iStatus = KRequestPending; 
    45 		SetActive();
    46 		}
    47 	// From CActive
    48 	virtual void RunL()
    49 		{
    50 		CActiveScheduler::Stop();
    51 		}
    52 	virtual void DoCancel()
    53 		{
    54 		CActiveScheduler::Stop();
    55 		}
    56 	};
    57 
    58 class CDevSoundTestStepBase : public CSimulProcTestStep, public MDevSoundObserver
    59 	{
    60 public:
    61 	static CDevSoundTestStepBase* NewL();
    62 	void ConstructL();
    63 	virtual void StartProcessing(TRequestStatus& aStatus);
    64 	virtual TVerdict EndProcessingAndReturnResult(TDes8& aMessage);		
    65 	virtual ~CDevSoundTestStepBase();
    66 
    67 protected:
    68 	enum TCallback 
    69 		{
    70 		EInitComplete,
    71 		EToneFinished,
    72 		EBuffToFill,
    73 		EPlayError,
    74 		EBuffToEmpty,
    75 		ERecError,
    76 		EConvertMsg,
    77 		EDeviceMsg
    78 		};
    79 
    80 	void InitializeComplete (TInt aError);
    81 	void ToneFinished (TInt aError);
    82 	void BufferToBeFilled (CMMFBuffer* aBuffer);
    83 	void PlayError (TInt aError);
    84 	void BufferToBeEmptied (CMMFBuffer* aBuffer);
    85 	void RecordError (TInt aError);
    86 	void ConvertError (TInt aError);
    87 	void DeviceMessage (TUid aMessageType, const TDesC8& aMsg);
    88 
    89 	TVerdict ConstructDevSound();
    90 	TVerdict DoTestStepPreambleL();
    91 	TVerdict TestInitialize(TMMFState aMode);
    92 	TVerdict TestPlayTone(TInt aFreq, TTimeIntervalMicroSeconds aDur);
    93 	void TestSetVolume(TInt aVol);
    94 	void TestSetPriority(TInt aPriority);
    95 	void TestSetGain(TInt aGain);
    96 
    97 protected:
    98 	CDevSoundTestStepBase();
    99 
   100 	TRequestStatus* iStatus;
   101 	TVerdict iVerdict;
   102 
   103 	TFixedArray<TInt, 7> iCallbackArray;
   104 	void ResetCallbacks();
   105 	TInt GetCallbackTotal();
   106 
   107 	CMMFBuffer* iBuffer;
   108 
   109 	CMMFDevSound* iMMFDevSound;
   110 	TInt iExpectedValue;
   111 	TInt iCallbackError;
   112 	};
   113 	
   114 #ifdef Required
   115 //class CTestStep1 : public CSimulProcTestStep, /*public MMdaObjectStateChangeObserver,*/ public MDevSoundObserver
   116 class CTestStep1 : public CDevSoundTestStepBase
   117 	{
   118 public:
   119 	static CTestStep1* NewL();
   120 	void ConstructL();
   121 	virtual void StartProcessing(TRequestStatus& aStatus);
   122 	virtual TVerdict EndProcessingAndReturnResult(TDes8& aMessage);		
   123 	virtual ~CTestStep1();
   124 
   125 protected:
   126 	void InitializeComplete (TInt aError);
   127 	void ToneFinished (TInt aError);
   128 
   129 	TVerdict DoPlaySimpleTone();
   130 	TVerdict TestInitialize(TMMFState aMode);
   131 	TVerdict TestPlayTone(TInt aFreq, TTimeIntervalMicroSeconds aDur);
   132 
   133 private:
   134 	TBool iIsFirstPlayed;
   135 	
   136 	};
   137 #endif
   138 
   139 #endif
   140 
   141