1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/mm/mmlibs/mmfw/tsrc/mmfintegrationtest/ACLNT/TSI_MMFACLNT.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,309 @@
1.4 +
1.5 +// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
1.6 +// All rights reserved.
1.7 +// This component and the accompanying materials are made available
1.8 +// under the terms of "Eclipse Public License v1.0"
1.9 +// which accompanies this distribution, and is available
1.10 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.11 +//
1.12 +// Initial Contributors:
1.13 +// Nokia Corporation - initial contribution.
1.14 +//
1.15 +// Contributors:
1.16 +//
1.17 +// Description:
1.18 +// Header file: Basic tests.
1.19 +//
1.20 +//
1.21 +
1.22 +/**
1.23 + @file TSI_MMFACLNT.h
1.24 +*/
1.25 +
1.26 +#ifndef TSI_MMFACLNT_H__
1.27 +#define TSI_MMFACLNT_H__
1.28 +
1.29 +#include <e32base.h>
1.30 +#include <badesca.h>
1.31 +#include <e32test.h>
1.32 +#include <e32keys.h>
1.33 +#include <c32comm.h>
1.34 +#include <f32file.h>
1.35 +#include <etel.h>
1.36 +#include <etelmm.h>
1.37 +#include <utf.h>
1.38 +#include <testframework.h>
1.39 +
1.40 +#include <mdaaudiosampleplayer.h>
1.41 +#include <mdaaudiosampleeditor.h>
1.42 +#include <mdaaudiotoneplayer.h>
1.43 +#include <mmfformatimplementationuids.hrh>
1.44 +
1.45 +
1.46 +#include "toneTest.h"
1.47 +
1.48 +class CTestSuite ;
1.49 +
1.50 +/**
1.51 + * Global Data used within tests
1.52 + *
1.53 + */
1.54 +_LIT(KDTMFString,"01234, 56789, ABCDEF#*");
1.55 +_LIT(KShortDTMFString,"0");
1.56 +_LIT(KInvalidDTMFString,"XVB4, ?>, !1231\x00ac|");
1.57 +_LIT(KDefault,"C:\\AclntITestData\\xxxxx.xxx");
1.58 +
1.59 +
1.60 +#define _LIT8CORRUPTDATA__(name,data) const static TLitPtrC8 name={(sizeof(data) | (1<<5)),REINTERPRET_CAST(const TUint8*,data)}
1.61 +_LIT8CORRUPTDATA__(KCorruptFixedSequenceData,KFixedSequenceTestSequenceData);
1.62 +
1.63 +#define NUMBER_OF_REPEATS 3
1.64 +
1.65 +const TInt KTwelveOfMicroSecond = 83333;
1.66 +const TInt KTenPartOfSec = 100000 ;
1.67 +const TInt KOneSecond = 1000000; // Used in a time out function, 1 second (in microSeconds)#
1.68 +const TInt KTwoSeconds = KOneSecond*2;
1.69 +const TInt KTenSeconds = 10000000; // Used in a time out function, 10 seconds (in microSeconds)
1.70 +const TInt KFiveSeconds = 5000000; // 5 seconds (in microSeconds)
1.71 +const TInt KFifteenSeconds = 15000000; // 15 seconds (in microSeconds)
1.72 +const TInt KExpectedDeviation= 1500000; // 1.5 second tolerance for timed tests
1.73 +const TInt KNameBufSize = 25;
1.74 +const TInt KIDBufSize = 50;
1.75 +const TInt KExpectedDurationDeviation = 3000; // 3 millisecond tolerance for duration
1.76 +
1.77 +//Amendment (for CTestMmfAclntConPosition)
1.78 +const TInt KDeviation= 1000000; // 1.0 second deviation
1.79 +
1.80 +
1.81 +//const TInt KPcm16FrameInterval = 371424;
1.82 +//const TInt KPcm16FrameInterval = 371512;
1.83 +//const TInt KPcm16FrameInterval = 278639;
1.84 +// frame size is now variable, depending on the sample rate
1.85 +//const TUint KFrameSize8K = 2048; // frame size for 8Khz
1.86 +const TUint KFrameSize11K = 3072; // frame size for 11Khz
1.87 +const TUint KPcmBitsPerSample8 = 8;
1.88 +const TUint KPcmChannels = 1;
1.89 +const TUint KSampleRate11K = 11025;
1.90 +const TInt KPcm16FrameInterval =
1.91 + (((KFrameSize11K * 1000000 / KSampleRate11K) /
1.92 + KPcmBitsPerSample8 * KPcmChannels)
1.93 + * 8);
1.94 +
1.95 +
1.96 +const TInt KFixedSequenceCount = 6;
1.97 +const TInt KMaxVolume = 65535;
1.98 +
1.99 +const TInt KMaxBalance = 100;
1.100 +const TInt KMinBalance = -100;
1.101 +const TInt KRecSize = 10000;
1.102 +const TInt KToneFrequency = 880;
1.103 +const TInt KToneFrequencyTwo = 1880;
1.104 +const TInt KSoundFileLength = 8359183;
1.105 +const TInt KInvalidNumber = 6234623;
1.106 +
1.107 +//pinched from MmfAudioInput.h:
1.108 +const TUint KAudioInputMinFrameSize = 0x800; //2K
1.109 +const TUint KAudioInputMaxFrameSize = 0x4000; //16K
1.110 +const TUint KAudioInputDeltaFrameSize = 0x400; //1K
1.111 +const TUint KAudioInputDefaultFrameSize = 0x1000; //4K
1.112 +const TUint KAudioInputFramesPerSecond = 4;
1.113 +//pinched from gsm610.h:
1.114 +const TUint KGsmEncodedFrameSize = 65;
1.115 +
1.116 +
1.117 +
1.118 +
1.119 +/**
1.120 + * @ TMmfAclntWavEncodeClipFormat, provides a class to support interfaces that require a
1.121 + * @ TMdaClipFormat.
1.122 + */
1.123 +const TUid KMmfUidEncodeFormatWAV = {KMmfUidFormatWAVWrite};
1.124 +class TMmfAclntWavEncodeClipFormat : public TMdaClipFormat
1.125 + {
1.126 +public:
1.127 + inline TMmfAclntWavEncodeClipFormat();
1.128 + };
1.129 +inline TMmfAclntWavEncodeClipFormat::TMmfAclntWavEncodeClipFormat() :
1.130 +TMdaClipFormat(KMmfUidEncodeFormatWAV,sizeof(TMmfAclntWavEncodeClipFormat)) {}
1.131 +
1.132 +/**
1.133 + * @ TMmfAclntWavDecodeClipFormat, provides a class to support interfaces that require a
1.134 + * @ TMdaClipFormat.
1.135 + */
1.136 +const TUid KMmfUidDecodeFormatWAV = {KMmfUidFormatWAVRead};
1.137 +class TMmfAclntWavDecodeClipFormat : public TMdaClipFormat
1.138 + {
1.139 +public:
1.140 + inline TMmfAclntWavDecodeClipFormat();
1.141 + };
1.142 +inline TMmfAclntWavDecodeClipFormat::TMmfAclntWavDecodeClipFormat() :
1.143 +TMdaClipFormat(KMmfUidDecodeFormatWAV,sizeof(TMmfAclntWavDecodeClipFormat)) {}
1.144 +
1.145 +
1.146 +/**
1.147 + * @ MCallbackHandlerObserver, provides an Observer
1.148 + * @ for monitoring callbacks.
1.149 + */
1.150 +class MCallbackHandlerObserver
1.151 + {
1.152 +public:
1.153 + virtual void MchoComplete(TInt aID, TInt aError)=0;
1.154 + };
1.155 +
1.156 +/**
1.157 + * CCallbackHandler provides an Observer
1.158 + * for monitoring MMdaAudioPlayerCallback callbacks.
1.159 + *
1.160 + * @ class CPlayerCallbackHandler
1.161 + *
1.162 + */
1.163 +class CPlayerCallbackHandler : public MMdaAudioPlayerCallback
1.164 + {
1.165 +public:
1.166 + CPlayerCallbackHandler(const TInt aID, MCallbackHandlerObserver* aMchObserver) : iMchObserver(aMchObserver), iID(aID) {};
1.167 + TInt ID();
1.168 +
1.169 + // from MMdaAudioPlayerCallback
1.170 + virtual void MapcInitComplete(TInt aError, const TTimeIntervalMicroSeconds& aDuration);
1.171 + virtual void MapcPlayComplete(TInt aError);
1.172 +
1.173 +private:
1.174 + MCallbackHandlerObserver* iMchObserver;
1.175 + TInt iID;
1.176 + };
1.177 +
1.178 +/**
1.179 + * CCallbackHandler provides an Observer for
1.180 + * monitoring MMdaObjectStateChangeObserver callbacks.
1.181 + *
1.182 + * @class CStateCallbackHandler
1.183 + *
1.184 + */
1.185 +class CStateCallbackHandler : public MMdaObjectStateChangeObserver
1.186 + {
1.187 +public:
1.188 + CStateCallbackHandler(const TInt aID, MCallbackHandlerObserver* aMchObserver) : iMchObserver(aMchObserver), iID(aID) {};
1.189 + TInt ID();
1.190 +
1.191 + // from MMdaObjectStateChangeObserver
1.192 + virtual void MoscoStateChangeEvent(CBase* /*aObject*/, TInt /*aPreviousState*/, TInt /*aCurrentState*/, TInt aErrorCode);
1.193 +
1.194 +private:
1.195 + MCallbackHandlerObserver* iMchObserver;
1.196 + TInt iID;
1.197 + };
1.198 +
1.199 +
1.200 +/**
1.201 + * provides an Observer for monitoring MMdaAudioToneObserver callbacks.
1.202 + *
1.203 + * @class CToneCallbackHandler
1.204 + *
1.205 + */
1.206 +class CToneCallbackHandler : public MMdaAudioToneObserver
1.207 + {
1.208 +public:
1.209 + CToneCallbackHandler(const TInt aID, MCallbackHandlerObserver* aMchObserver) : iMchObserver(aMchObserver), iID(aID) {};
1.210 + TInt ID();
1.211 +
1.212 + // From MMdaAudioToneObserver
1.213 + virtual void MatoPrepareComplete(TInt aError);
1.214 + virtual void MatoPlayComplete(TInt aError);
1.215 +
1.216 +private:
1.217 + MCallbackHandlerObserver* iMchObserver;
1.218 + TInt iID;
1.219 + };
1.220 +
1.221 +/**
1.222 + *
1.223 + * CActiveListener provides the asynchronous operation
1.224 + * of an active object
1.225 + *
1.226 + * @class CActiveListener
1.227 + *
1.228 + */
1.229 +class CActiveListener : public CActive
1.230 + {
1.231 +public:
1.232 + CActiveListener();
1.233 + void InitialiseActiveListener();
1.234 + // From CActive
1.235 + virtual void RunL();
1.236 + virtual void DoCancel() {};
1.237 + };
1.238 +
1.239 +
1.240 +/**
1.241 + * It's a base class for all test steps.
1.242 + *
1.243 + * @class CTestMmfAclntStep
1.244 + * @brief Test class that enables tests.
1.245 + *
1.246 + */
1.247 +class CTestMmfAclntStep : public CTestStep
1.248 + {
1.249 +public:
1.250 + CTestMmfAclntStep();
1.251 + static void CleanUp(TAny *aPtr) ;
1.252 + void SetTestSuite(const CTestSuite* aTestSuite );
1.253 +
1.254 +protected:
1.255 + void WaitWithTimeout(TRequestStatus& aStatus, TInt aNumberOfMicroSeconds);
1.256 + TBool TimeComparison(const TUint aActual, const TUint aExpected, const TUint aDivation);
1.257 +
1.258 + // tests may optionally implement pre- and post-ambles
1.259 + virtual TVerdict DoTestStepPreambleL();
1.260 + virtual TVerdict DoTestStepPostambleL();
1.261 +
1.262 +protected:
1.263 + const CTestSuite* iTestSuite ;
1.264 + CActiveScheduler* iActiveScheduler;
1.265 + };
1.266 +
1.267 +/**
1.268 + * Test base class that adds codec specific
1.269 + * functionalty (applys to tests that create files).
1.270 + *
1.271 + * @class CTestMmfAclntCodecTest
1.272 + * @codec specific test base class.
1.273 + *
1.274 + */
1.275 +class CTestMmfAclntCodecTest : public CTestMmfAclntStep
1.276 + {
1.277 +public:
1.278 + enum TTestFormat
1.279 + {
1.280 + ENone,
1.281 + EPcm16Wav,
1.282 + EMulawRaw,
1.283 + E16BitAu,
1.284 + EAlawAu,
1.285 + EPcm16Au,
1.286 + EImaAdpcmWav,
1.287 + EImasPcmWav,
1.288 + EPcm8,
1.289 + EPcmU8,
1.290 + EPcmU16,
1.291 + EAlawWav,
1.292 + EEpocWve,
1.293 + EGsmWav
1.294 + };
1.295 +public:
1.296 + void SetupFormatL(const TTestFormat aFormat);
1.297 + TVerdict DoTestStepPostambleL();
1.298 +
1.299 +protected:
1.300 + TMdaClipFormat* iFormat;
1.301 + TMdaPackage* iCodec;
1.302 + TMdaAudioDataSettings iAudioSettings;
1.303 + TTestFormat iTestFormat;
1.304 + };
1.305 +
1.306 +
1.307 +TAny GetDriveName(TDes& aFileName);
1.308 +const TInt KSizeBuf = 256;
1.309 +
1.310 +
1.311 +#endif// TSI_MMFACLNT_H__
1.312 +