os/mm/mmlibs/mmfw/tsrc/mmfintegrationtest/ACLNT/TSI_MMFACLNT.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
sl@0
     2
// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     3
// All rights reserved.
sl@0
     4
// This component and the accompanying materials are made available
sl@0
     5
// under the terms of "Eclipse Public License v1.0"
sl@0
     6
// which accompanies this distribution, and is available
sl@0
     7
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     8
//
sl@0
     9
// Initial Contributors:
sl@0
    10
// Nokia Corporation - initial contribution.
sl@0
    11
//
sl@0
    12
// Contributors:
sl@0
    13
//
sl@0
    14
// Description:
sl@0
    15
// Header file: Basic  tests.
sl@0
    16
// 
sl@0
    17
//
sl@0
    18
sl@0
    19
/**
sl@0
    20
 @file TSI_MMFACLNT.h
sl@0
    21
*/
sl@0
    22
sl@0
    23
#ifndef TSI_MMFACLNT_H__
sl@0
    24
#define TSI_MMFACLNT_H__
sl@0
    25
sl@0
    26
#include <e32base.h>
sl@0
    27
#include <badesca.h>
sl@0
    28
#include <e32test.h>
sl@0
    29
#include <e32keys.h>
sl@0
    30
#include <c32comm.h>
sl@0
    31
#include <f32file.h>
sl@0
    32
#include <etel.h>
sl@0
    33
#include <etelmm.h>
sl@0
    34
#include <utf.h>
sl@0
    35
#include <testframework.h>
sl@0
    36
sl@0
    37
#include <mdaaudiosampleplayer.h>
sl@0
    38
#include <mdaaudiosampleeditor.h>
sl@0
    39
#include <mdaaudiotoneplayer.h>
sl@0
    40
#include <mmfformatimplementationuids.hrh>
sl@0
    41
sl@0
    42
sl@0
    43
#include "toneTest.h"
sl@0
    44
sl@0
    45
class CTestSuite ;
sl@0
    46
sl@0
    47
/**
sl@0
    48
 * Global Data used within tests
sl@0
    49
 *
sl@0
    50
 */
sl@0
    51
_LIT(KDTMFString,"01234, 56789, ABCDEF#*");
sl@0
    52
_LIT(KShortDTMFString,"0");
sl@0
    53
_LIT(KInvalidDTMFString,"XVB4, ?>, !1231\x00ac|");
sl@0
    54
_LIT(KDefault,"C:\\AclntITestData\\xxxxx.xxx"); 
sl@0
    55
sl@0
    56
sl@0
    57
#define _LIT8CORRUPTDATA__(name,data) const static TLitPtrC8 name={(sizeof(data) | (1<<5)),REINTERPRET_CAST(const TUint8*,data)}
sl@0
    58
_LIT8CORRUPTDATA__(KCorruptFixedSequenceData,KFixedSequenceTestSequenceData);
sl@0
    59
sl@0
    60
#define NUMBER_OF_REPEATS 3
sl@0
    61
sl@0
    62
const TInt KTwelveOfMicroSecond = 83333;
sl@0
    63
const TInt KTenPartOfSec	= 100000 ;
sl@0
    64
const TInt KOneSecond		= 1000000;	// Used in a time out function, 1 second (in microSeconds)#
sl@0
    65
const TInt KTwoSeconds		= KOneSecond*2;
sl@0
    66
const TInt KTenSeconds		= 10000000;	// Used in a time out function, 10 seconds (in microSeconds)
sl@0
    67
const TInt KFiveSeconds		= 5000000;	// 5 seconds (in microSeconds)
sl@0
    68
const TInt KFifteenSeconds	= 15000000;	// 15 seconds (in microSeconds)
sl@0
    69
const TInt KExpectedDeviation= 1500000; // 1.5 second tolerance for timed tests
sl@0
    70
const TInt KNameBufSize		= 25;
sl@0
    71
const TInt KIDBufSize       = 50;
sl@0
    72
const TInt KExpectedDurationDeviation = 3000;	// 3 millisecond tolerance for duration
sl@0
    73
sl@0
    74
//Amendment (for CTestMmfAclntConPosition)
sl@0
    75
const TInt KDeviation= 1000000; // 1.0 second deviation
sl@0
    76
sl@0
    77
sl@0
    78
//const TInt KPcm16FrameInterval = 371424;
sl@0
    79
//const TInt KPcm16FrameInterval = 371512;
sl@0
    80
//const TInt KPcm16FrameInterval = 278639;
sl@0
    81
// frame size is now variable, depending on the sample rate
sl@0
    82
//const TUint KFrameSize8K = 2048;	// frame size for 8Khz
sl@0
    83
const TUint KFrameSize11K = 3072;	// frame size for 11Khz
sl@0
    84
const TUint KPcmBitsPerSample8 = 8;
sl@0
    85
const TUint KPcmChannels = 1;
sl@0
    86
const TUint KSampleRate11K = 11025;
sl@0
    87
const TInt KPcm16FrameInterval = 
sl@0
    88
	(((KFrameSize11K * 1000000 / KSampleRate11K) /
sl@0
    89
	 KPcmBitsPerSample8 * KPcmChannels)
sl@0
    90
	* 8);
sl@0
    91
sl@0
    92
sl@0
    93
const TInt KFixedSequenceCount = 6;
sl@0
    94
const TInt KMaxVolume = 65535;
sl@0
    95
sl@0
    96
const TInt KMaxBalance = 100;
sl@0
    97
const TInt KMinBalance = -100;
sl@0
    98
const TInt KRecSize = 10000;
sl@0
    99
const TInt KToneFrequency = 880;
sl@0
   100
const TInt KToneFrequencyTwo = 1880;
sl@0
   101
const TInt KSoundFileLength = 8359183;
sl@0
   102
const TInt KInvalidNumber =	6234623;
sl@0
   103
sl@0
   104
//pinched from MmfAudioInput.h:
sl@0
   105
const TUint KAudioInputMinFrameSize = 0x800; //2K
sl@0
   106
const TUint KAudioInputMaxFrameSize = 0x4000; //16K
sl@0
   107
const TUint KAudioInputDeltaFrameSize = 0x400;  //1K
sl@0
   108
const TUint KAudioInputDefaultFrameSize = 0x1000;  //4K
sl@0
   109
const TUint KAudioInputFramesPerSecond = 4;
sl@0
   110
//pinched from gsm610.h:
sl@0
   111
const TUint	KGsmEncodedFrameSize = 65;
sl@0
   112
sl@0
   113
sl@0
   114
sl@0
   115
sl@0
   116
/**
sl@0
   117
 * @ TMmfAclntWavEncodeClipFormat, provides a class to support interfaces that require a 
sl@0
   118
 * @ TMdaClipFormat.
sl@0
   119
 */
sl@0
   120
const TUid KMmfUidEncodeFormatWAV = {KMmfUidFormatWAVWrite};
sl@0
   121
class TMmfAclntWavEncodeClipFormat : public TMdaClipFormat
sl@0
   122
	{
sl@0
   123
public:
sl@0
   124
	inline TMmfAclntWavEncodeClipFormat();
sl@0
   125
	};
sl@0
   126
inline TMmfAclntWavEncodeClipFormat::TMmfAclntWavEncodeClipFormat() : 
sl@0
   127
TMdaClipFormat(KMmfUidEncodeFormatWAV,sizeof(TMmfAclntWavEncodeClipFormat)) {}
sl@0
   128
sl@0
   129
/**
sl@0
   130
 * @ TMmfAclntWavDecodeClipFormat, provides a class to support interfaces that require a 
sl@0
   131
 * @ TMdaClipFormat.
sl@0
   132
 */
sl@0
   133
const TUid KMmfUidDecodeFormatWAV = {KMmfUidFormatWAVRead};
sl@0
   134
class TMmfAclntWavDecodeClipFormat : public TMdaClipFormat
sl@0
   135
	{
sl@0
   136
public:
sl@0
   137
	inline TMmfAclntWavDecodeClipFormat();
sl@0
   138
	};
sl@0
   139
inline TMmfAclntWavDecodeClipFormat::TMmfAclntWavDecodeClipFormat() : 
sl@0
   140
TMdaClipFormat(KMmfUidDecodeFormatWAV,sizeof(TMmfAclntWavDecodeClipFormat)) {}
sl@0
   141
sl@0
   142
sl@0
   143
/**
sl@0
   144
 * @ MCallbackHandlerObserver, provides an Observer
sl@0
   145
 * @ for monitoring callbacks.
sl@0
   146
 */
sl@0
   147
class MCallbackHandlerObserver
sl@0
   148
	{
sl@0
   149
public:
sl@0
   150
	virtual void MchoComplete(TInt aID, TInt aError)=0;
sl@0
   151
	};
sl@0
   152
sl@0
   153
/**
sl@0
   154
 * CCallbackHandler provides an Observer
sl@0
   155
 * for monitoring MMdaAudioPlayerCallback callbacks.
sl@0
   156
 *
sl@0
   157
 * @ class CPlayerCallbackHandler
sl@0
   158
 *
sl@0
   159
 */
sl@0
   160
class CPlayerCallbackHandler : public MMdaAudioPlayerCallback
sl@0
   161
	{
sl@0
   162
public:
sl@0
   163
	CPlayerCallbackHandler(const TInt aID, MCallbackHandlerObserver* aMchObserver) : iMchObserver(aMchObserver), iID(aID)  {};
sl@0
   164
	TInt ID();	
sl@0
   165
sl@0
   166
	// from MMdaAudioPlayerCallback
sl@0
   167
    virtual void MapcInitComplete(TInt aError, const TTimeIntervalMicroSeconds& aDuration);
sl@0
   168
    virtual void MapcPlayComplete(TInt aError);
sl@0
   169
	
sl@0
   170
private:
sl@0
   171
	MCallbackHandlerObserver* iMchObserver;
sl@0
   172
	TInt iID;
sl@0
   173
	};
sl@0
   174
sl@0
   175
/**
sl@0
   176
 * CCallbackHandler provides an Observer for 
sl@0
   177
 * monitoring MMdaObjectStateChangeObserver callbacks. 
sl@0
   178
 *
sl@0
   179
 * @class CStateCallbackHandler
sl@0
   180
 *
sl@0
   181
 */
sl@0
   182
class CStateCallbackHandler : public MMdaObjectStateChangeObserver
sl@0
   183
	{
sl@0
   184
public:
sl@0
   185
	CStateCallbackHandler(const TInt aID, MCallbackHandlerObserver* aMchObserver) : iMchObserver(aMchObserver), iID(aID) {};
sl@0
   186
	TInt ID();	
sl@0
   187
sl@0
   188
	// from MMdaObjectStateChangeObserver
sl@0
   189
	virtual void MoscoStateChangeEvent(CBase* /*aObject*/, TInt /*aPreviousState*/, TInt /*aCurrentState*/, TInt aErrorCode);
sl@0
   190
sl@0
   191
private:
sl@0
   192
	MCallbackHandlerObserver* iMchObserver;
sl@0
   193
	TInt iID;
sl@0
   194
	};
sl@0
   195
sl@0
   196
sl@0
   197
/**
sl@0
   198
 * provides an Observer for monitoring MMdaAudioToneObserver callbacks.
sl@0
   199
 *
sl@0
   200
 * @class CToneCallbackHandler
sl@0
   201
 *
sl@0
   202
 */
sl@0
   203
class CToneCallbackHandler : public MMdaAudioToneObserver
sl@0
   204
	{
sl@0
   205
public:
sl@0
   206
	CToneCallbackHandler(const TInt aID, MCallbackHandlerObserver* aMchObserver) : iMchObserver(aMchObserver), iID(aID)  {};
sl@0
   207
	TInt ID();	
sl@0
   208
sl@0
   209
	// From MMdaAudioToneObserver
sl@0
   210
	virtual void MatoPrepareComplete(TInt aError);
sl@0
   211
	virtual void MatoPlayComplete(TInt aError);
sl@0
   212
sl@0
   213
private:
sl@0
   214
	MCallbackHandlerObserver* iMchObserver;
sl@0
   215
	TInt iID;
sl@0
   216
	};
sl@0
   217
sl@0
   218
/**
sl@0
   219
 *
sl@0
   220
 * CActiveListener provides the asynchronous operation
sl@0
   221
 * of an active object
sl@0
   222
 *
sl@0
   223
 * @class CActiveListener
sl@0
   224
 *
sl@0
   225
 */
sl@0
   226
class CActiveListener : public CActive
sl@0
   227
	{
sl@0
   228
public:
sl@0
   229
	CActiveListener();
sl@0
   230
	void InitialiseActiveListener();
sl@0
   231
	// From CActive
sl@0
   232
	virtual void RunL();
sl@0
   233
	virtual void DoCancel() {};
sl@0
   234
	};
sl@0
   235
sl@0
   236
sl@0
   237
/**
sl@0
   238
 * It's a base class for all test steps.
sl@0
   239
 *
sl@0
   240
 * @class CTestMmfAclntStep 
sl@0
   241
 * @brief Test class that enables tests.
sl@0
   242
 *
sl@0
   243
 */
sl@0
   244
class CTestMmfAclntStep : public CTestStep
sl@0
   245
	{
sl@0
   246
public:
sl@0
   247
	CTestMmfAclntStep();
sl@0
   248
	static void CleanUp(TAny *aPtr) ;
sl@0
   249
	void SetTestSuite(const CTestSuite* aTestSuite );
sl@0
   250
sl@0
   251
protected:
sl@0
   252
	void WaitWithTimeout(TRequestStatus& aStatus, TInt aNumberOfMicroSeconds);
sl@0
   253
	TBool TimeComparison(const TUint aActual, const TUint aExpected, const TUint aDivation);
sl@0
   254
sl@0
   255
	// tests may optionally implement pre- and post-ambles
sl@0
   256
	virtual TVerdict DoTestStepPreambleL();
sl@0
   257
	virtual TVerdict DoTestStepPostambleL();
sl@0
   258
sl@0
   259
protected:
sl@0
   260
	const CTestSuite* iTestSuite ;
sl@0
   261
	CActiveScheduler* iActiveScheduler;
sl@0
   262
	};
sl@0
   263
sl@0
   264
/**
sl@0
   265
 * Test base class that adds codec specific
sl@0
   266
 * functionalty (applys to tests that create files).
sl@0
   267
 *
sl@0
   268
 * @class CTestMmfAclntCodecTest
sl@0
   269
 * @codec specific test base class.
sl@0
   270
 *
sl@0
   271
 */
sl@0
   272
class CTestMmfAclntCodecTest : public CTestMmfAclntStep
sl@0
   273
	{
sl@0
   274
public:
sl@0
   275
	enum TTestFormat
sl@0
   276
		{
sl@0
   277
		ENone,
sl@0
   278
		EPcm16Wav,
sl@0
   279
		EMulawRaw,
sl@0
   280
		E16BitAu,
sl@0
   281
		EAlawAu,
sl@0
   282
		EPcm16Au,
sl@0
   283
		EImaAdpcmWav,
sl@0
   284
		EImasPcmWav,
sl@0
   285
		EPcm8,
sl@0
   286
		EPcmU8,
sl@0
   287
		EPcmU16,
sl@0
   288
		EAlawWav,
sl@0
   289
		EEpocWve,
sl@0
   290
		EGsmWav
sl@0
   291
		};
sl@0
   292
public:
sl@0
   293
	void SetupFormatL(const TTestFormat aFormat);
sl@0
   294
	TVerdict DoTestStepPostambleL();
sl@0
   295
	
sl@0
   296
protected:
sl@0
   297
	TMdaClipFormat* iFormat;
sl@0
   298
	TMdaPackage* iCodec;
sl@0
   299
	TMdaAudioDataSettings iAudioSettings;
sl@0
   300
	TTestFormat iTestFormat;
sl@0
   301
	};
sl@0
   302
sl@0
   303
sl@0
   304
TAny	GetDriveName(TDes& aFileName);
sl@0
   305
const TInt	KSizeBuf = 256;
sl@0
   306
sl@0
   307
sl@0
   308
#endif// TSI_MMFACLNT_H__
sl@0
   309