Update contrib.
2 // Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
3 // All rights reserved.
4 // This component and the accompanying materials are made available
5 // under the terms of "Eclipse Public License v1.0"
6 // which accompanies this distribution, and is available
7 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
9 // Initial Contributors:
10 // Nokia Corporation - initial contribution.
15 // Header file: Basic tests.
23 #ifndef TSI_MMFACLNT_H__
24 #define TSI_MMFACLNT_H__
35 #include <testframework.h>
37 #include <mdaaudiosampleplayer.h>
38 #include <mdaaudiosampleeditor.h>
39 #include <mdaaudiotoneplayer.h>
40 #include <mmfformatimplementationuids.hrh>
48 * Global Data used within tests
51 _LIT(KDTMFString,"01234, 56789, ABCDEF#*");
52 _LIT(KShortDTMFString,"0");
53 _LIT(KInvalidDTMFString,"XVB4, ?>, !1231\x00ac|");
54 _LIT(KDefault,"C:\\AclntITestData\\xxxxx.xxx");
57 #define _LIT8CORRUPTDATA__(name,data) const static TLitPtrC8 name={(sizeof(data) | (1<<5)),REINTERPRET_CAST(const TUint8*,data)}
58 _LIT8CORRUPTDATA__(KCorruptFixedSequenceData,KFixedSequenceTestSequenceData);
60 #define NUMBER_OF_REPEATS 3
62 const TInt KTwelveOfMicroSecond = 83333;
63 const TInt KTenPartOfSec = 100000 ;
64 const TInt KOneSecond = 1000000; // Used in a time out function, 1 second (in microSeconds)#
65 const TInt KTwoSeconds = KOneSecond*2;
66 const TInt KTenSeconds = 10000000; // Used in a time out function, 10 seconds (in microSeconds)
67 const TInt KFiveSeconds = 5000000; // 5 seconds (in microSeconds)
68 const TInt KFifteenSeconds = 15000000; // 15 seconds (in microSeconds)
69 const TInt KExpectedDeviation= 1500000; // 1.5 second tolerance for timed tests
70 const TInt KNameBufSize = 25;
71 const TInt KIDBufSize = 50;
72 const TInt KExpectedDurationDeviation = 3000; // 3 millisecond tolerance for duration
74 //Amendment (for CTestMmfAclntConPosition)
75 const TInt KDeviation= 1000000; // 1.0 second deviation
78 //const TInt KPcm16FrameInterval = 371424;
79 //const TInt KPcm16FrameInterval = 371512;
80 //const TInt KPcm16FrameInterval = 278639;
81 // frame size is now variable, depending on the sample rate
82 //const TUint KFrameSize8K = 2048; // frame size for 8Khz
83 const TUint KFrameSize11K = 3072; // frame size for 11Khz
84 const TUint KPcmBitsPerSample8 = 8;
85 const TUint KPcmChannels = 1;
86 const TUint KSampleRate11K = 11025;
87 const TInt KPcm16FrameInterval =
88 (((KFrameSize11K * 1000000 / KSampleRate11K) /
89 KPcmBitsPerSample8 * KPcmChannels)
93 const TInt KFixedSequenceCount = 6;
94 const TInt KMaxVolume = 65535;
96 const TInt KMaxBalance = 100;
97 const TInt KMinBalance = -100;
98 const TInt KRecSize = 10000;
99 const TInt KToneFrequency = 880;
100 const TInt KToneFrequencyTwo = 1880;
101 const TInt KSoundFileLength = 8359183;
102 const TInt KInvalidNumber = 6234623;
104 //pinched from MmfAudioInput.h:
105 const TUint KAudioInputMinFrameSize = 0x800; //2K
106 const TUint KAudioInputMaxFrameSize = 0x4000; //16K
107 const TUint KAudioInputDeltaFrameSize = 0x400; //1K
108 const TUint KAudioInputDefaultFrameSize = 0x1000; //4K
109 const TUint KAudioInputFramesPerSecond = 4;
110 //pinched from gsm610.h:
111 const TUint KGsmEncodedFrameSize = 65;
117 * @ TMmfAclntWavEncodeClipFormat, provides a class to support interfaces that require a
120 const TUid KMmfUidEncodeFormatWAV = {KMmfUidFormatWAVWrite};
121 class TMmfAclntWavEncodeClipFormat : public TMdaClipFormat
124 inline TMmfAclntWavEncodeClipFormat();
126 inline TMmfAclntWavEncodeClipFormat::TMmfAclntWavEncodeClipFormat() :
127 TMdaClipFormat(KMmfUidEncodeFormatWAV,sizeof(TMmfAclntWavEncodeClipFormat)) {}
130 * @ TMmfAclntWavDecodeClipFormat, provides a class to support interfaces that require a
133 const TUid KMmfUidDecodeFormatWAV = {KMmfUidFormatWAVRead};
134 class TMmfAclntWavDecodeClipFormat : public TMdaClipFormat
137 inline TMmfAclntWavDecodeClipFormat();
139 inline TMmfAclntWavDecodeClipFormat::TMmfAclntWavDecodeClipFormat() :
140 TMdaClipFormat(KMmfUidDecodeFormatWAV,sizeof(TMmfAclntWavDecodeClipFormat)) {}
144 * @ MCallbackHandlerObserver, provides an Observer
145 * @ for monitoring callbacks.
147 class MCallbackHandlerObserver
150 virtual void MchoComplete(TInt aID, TInt aError)=0;
154 * CCallbackHandler provides an Observer
155 * for monitoring MMdaAudioPlayerCallback callbacks.
157 * @ class CPlayerCallbackHandler
160 class CPlayerCallbackHandler : public MMdaAudioPlayerCallback
163 CPlayerCallbackHandler(const TInt aID, MCallbackHandlerObserver* aMchObserver) : iMchObserver(aMchObserver), iID(aID) {};
166 // from MMdaAudioPlayerCallback
167 virtual void MapcInitComplete(TInt aError, const TTimeIntervalMicroSeconds& aDuration);
168 virtual void MapcPlayComplete(TInt aError);
171 MCallbackHandlerObserver* iMchObserver;
176 * CCallbackHandler provides an Observer for
177 * monitoring MMdaObjectStateChangeObserver callbacks.
179 * @class CStateCallbackHandler
182 class CStateCallbackHandler : public MMdaObjectStateChangeObserver
185 CStateCallbackHandler(const TInt aID, MCallbackHandlerObserver* aMchObserver) : iMchObserver(aMchObserver), iID(aID) {};
188 // from MMdaObjectStateChangeObserver
189 virtual void MoscoStateChangeEvent(CBase* /*aObject*/, TInt /*aPreviousState*/, TInt /*aCurrentState*/, TInt aErrorCode);
192 MCallbackHandlerObserver* iMchObserver;
198 * provides an Observer for monitoring MMdaAudioToneObserver callbacks.
200 * @class CToneCallbackHandler
203 class CToneCallbackHandler : public MMdaAudioToneObserver
206 CToneCallbackHandler(const TInt aID, MCallbackHandlerObserver* aMchObserver) : iMchObserver(aMchObserver), iID(aID) {};
209 // From MMdaAudioToneObserver
210 virtual void MatoPrepareComplete(TInt aError);
211 virtual void MatoPlayComplete(TInt aError);
214 MCallbackHandlerObserver* iMchObserver;
220 * CActiveListener provides the asynchronous operation
221 * of an active object
223 * @class CActiveListener
226 class CActiveListener : public CActive
230 void InitialiseActiveListener();
233 virtual void DoCancel() {};
238 * It's a base class for all test steps.
240 * @class CTestMmfAclntStep
241 * @brief Test class that enables tests.
244 class CTestMmfAclntStep : public CTestStep
248 static void CleanUp(TAny *aPtr) ;
249 void SetTestSuite(const CTestSuite* aTestSuite );
252 void WaitWithTimeout(TRequestStatus& aStatus, TInt aNumberOfMicroSeconds);
253 TBool TimeComparison(const TUint aActual, const TUint aExpected, const TUint aDivation);
255 // tests may optionally implement pre- and post-ambles
256 virtual TVerdict DoTestStepPreambleL();
257 virtual TVerdict DoTestStepPostambleL();
260 const CTestSuite* iTestSuite ;
261 CActiveScheduler* iActiveScheduler;
265 * Test base class that adds codec specific
266 * functionalty (applys to tests that create files).
268 * @class CTestMmfAclntCodecTest
269 * @codec specific test base class.
272 class CTestMmfAclntCodecTest : public CTestMmfAclntStep
293 void SetupFormatL(const TTestFormat aFormat);
294 TVerdict DoTestStepPostambleL();
297 TMdaClipFormat* iFormat;
299 TMdaAudioDataSettings iAudioSettings;
300 TTestFormat iTestFormat;
304 TAny GetDriveName(TDes& aFileName);
305 const TInt KSizeBuf = 256;
308 #endif// TSI_MMFACLNT_H__