os/mm/mmlibs/mmfw/tsrc/mmfintegrationtest/SDevSound/SDSCapTestServer/src/CapTestStep.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/mm/mmlibs/mmfw/tsrc/mmfintegrationtest/SDevSound/SDSCapTestServer/src/CapTestStep.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,141 @@
     1.4 +// Copyright (c) 2004-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 __CAPTESTSTEP_H__
    1.20 +#define __CAPTESTSTEP_H__
    1.21 +
    1.22 +#include <mdaaudiosampleeditor.h>
    1.23 +#include <simulprocserver.h>
    1.24 +#include <mmf/server/sounddevice.h>
    1.25 +
    1.26 +const TInt KDevSoundPriorityLow=0;
    1.27 +const TInt KDevSoundPriorityHigh=100;
    1.28 +
    1.29 +/**
    1.30 + *
    1.31 + * CActiveListener provides the asynchronous operation
    1.32 + * of an active object
    1.33 + *
    1.34 + * @lib "TSI_MMF_SDEVSOUND_SUITE.lib"
    1.35 + *
    1.36 + *
    1.37 + */
    1.38 +class CActiveListener : public CActive
    1.39 +	{
    1.40 +public:
    1.41 +	CActiveListener() : CActive(CActive::EPriorityStandard) 
    1.42 +		{ 
    1.43 +		CActiveScheduler::Add(this);
    1.44 +		}
    1.45 +	void InitialiseActiveListener()
    1.46 +		{
    1.47 +		iStatus = KRequestPending; 
    1.48 +		SetActive();
    1.49 +		}
    1.50 +	// From CActive
    1.51 +	virtual void RunL()
    1.52 +		{
    1.53 +		CActiveScheduler::Stop();
    1.54 +		}
    1.55 +	virtual void DoCancel()
    1.56 +		{
    1.57 +		CActiveScheduler::Stop();
    1.58 +		}
    1.59 +	};
    1.60 +
    1.61 +class CDevSoundTestStepBase : public CSimulProcTestStep, public MDevSoundObserver
    1.62 +	{
    1.63 +public:
    1.64 +	static CDevSoundTestStepBase* NewL();
    1.65 +	void ConstructL();
    1.66 +	virtual void StartProcessing(TRequestStatus& aStatus);
    1.67 +	virtual TVerdict EndProcessingAndReturnResult(TDes8& aMessage);		
    1.68 +	virtual ~CDevSoundTestStepBase();
    1.69 +
    1.70 +protected:
    1.71 +	enum TCallback 
    1.72 +		{
    1.73 +		EInitComplete,
    1.74 +		EToneFinished,
    1.75 +		EBuffToFill,
    1.76 +		EPlayError,
    1.77 +		EBuffToEmpty,
    1.78 +		ERecError,
    1.79 +		EConvertMsg,
    1.80 +		EDeviceMsg
    1.81 +		};
    1.82 +
    1.83 +	void InitializeComplete (TInt aError);
    1.84 +	void ToneFinished (TInt aError);
    1.85 +	void BufferToBeFilled (CMMFBuffer* aBuffer);
    1.86 +	void PlayError (TInt aError);
    1.87 +	void BufferToBeEmptied (CMMFBuffer* aBuffer);
    1.88 +	void RecordError (TInt aError);
    1.89 +	void ConvertError (TInt aError);
    1.90 +	void DeviceMessage (TUid aMessageType, const TDesC8& aMsg);
    1.91 +
    1.92 +	TVerdict ConstructDevSound();
    1.93 +	TVerdict DoTestStepPreambleL();
    1.94 +	TVerdict TestInitialize(TMMFState aMode);
    1.95 +	TVerdict TestPlayTone(TInt aFreq, TTimeIntervalMicroSeconds aDur);
    1.96 +	void TestSetVolume(TInt aVol);
    1.97 +	void TestSetPriority(TInt aPriority);
    1.98 +	void TestSetGain(TInt aGain);
    1.99 +
   1.100 +protected:
   1.101 +	CDevSoundTestStepBase();
   1.102 +
   1.103 +	TRequestStatus* iStatus;
   1.104 +	TVerdict iVerdict;
   1.105 +
   1.106 +	TFixedArray<TInt, 7> iCallbackArray;
   1.107 +	void ResetCallbacks();
   1.108 +	TInt GetCallbackTotal();
   1.109 +
   1.110 +	CMMFBuffer* iBuffer;
   1.111 +
   1.112 +	CMMFDevSound* iMMFDevSound;
   1.113 +	TInt iExpectedValue;
   1.114 +	TInt iCallbackError;
   1.115 +	};
   1.116 +	
   1.117 +#ifdef Required
   1.118 +//class CTestStep1 : public CSimulProcTestStep, /*public MMdaObjectStateChangeObserver,*/ public MDevSoundObserver
   1.119 +class CTestStep1 : public CDevSoundTestStepBase
   1.120 +	{
   1.121 +public:
   1.122 +	static CTestStep1* NewL();
   1.123 +	void ConstructL();
   1.124 +	virtual void StartProcessing(TRequestStatus& aStatus);
   1.125 +	virtual TVerdict EndProcessingAndReturnResult(TDes8& aMessage);		
   1.126 +	virtual ~CTestStep1();
   1.127 +
   1.128 +protected:
   1.129 +	void InitializeComplete (TInt aError);
   1.130 +	void ToneFinished (TInt aError);
   1.131 +
   1.132 +	TVerdict DoPlaySimpleTone();
   1.133 +	TVerdict TestInitialize(TMMFState aMode);
   1.134 +	TVerdict TestPlayTone(TInt aFreq, TTimeIntervalMicroSeconds aDur);
   1.135 +
   1.136 +private:
   1.137 +	TBool iIsFirstPlayed;
   1.138 +	
   1.139 +	};
   1.140 +#endif
   1.141 +
   1.142 +#endif
   1.143 +
   1.144 +