sl@0: sl@0: // Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // Header file: Basic tests. sl@0: // sl@0: // sl@0: sl@0: /** sl@0: @file TSI_MMFACLNT.h sl@0: */ sl@0: sl@0: #ifndef TSI_MMFACLNT_H__ sl@0: #define TSI_MMFACLNT_H__ sl@0: sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: sl@0: sl@0: #include "toneTest.h" sl@0: sl@0: class CTestSuite ; sl@0: sl@0: /** sl@0: * Global Data used within tests sl@0: * sl@0: */ sl@0: _LIT(KDTMFString,"01234, 56789, ABCDEF#*"); sl@0: _LIT(KShortDTMFString,"0"); sl@0: _LIT(KInvalidDTMFString,"XVB4, ?>, !1231\x00ac|"); sl@0: _LIT(KDefault,"C:\\AclntITestData\\xxxxx.xxx"); sl@0: sl@0: sl@0: #define _LIT8CORRUPTDATA__(name,data) const static TLitPtrC8 name={(sizeof(data) | (1<<5)),REINTERPRET_CAST(const TUint8*,data)} sl@0: _LIT8CORRUPTDATA__(KCorruptFixedSequenceData,KFixedSequenceTestSequenceData); sl@0: sl@0: #define NUMBER_OF_REPEATS 3 sl@0: sl@0: const TInt KTwelveOfMicroSecond = 83333; sl@0: const TInt KTenPartOfSec = 100000 ; sl@0: const TInt KOneSecond = 1000000; // Used in a time out function, 1 second (in microSeconds)# sl@0: const TInt KTwoSeconds = KOneSecond*2; sl@0: const TInt KTenSeconds = 10000000; // Used in a time out function, 10 seconds (in microSeconds) sl@0: const TInt KFiveSeconds = 5000000; // 5 seconds (in microSeconds) sl@0: const TInt KFifteenSeconds = 15000000; // 15 seconds (in microSeconds) sl@0: const TInt KExpectedDeviation= 1500000; // 1.5 second tolerance for timed tests sl@0: const TInt KNameBufSize = 25; sl@0: const TInt KIDBufSize = 50; sl@0: const TInt KExpectedDurationDeviation = 3000; // 3 millisecond tolerance for duration sl@0: sl@0: //Amendment (for CTestMmfAclntConPosition) sl@0: const TInt KDeviation= 1000000; // 1.0 second deviation sl@0: sl@0: sl@0: //const TInt KPcm16FrameInterval = 371424; sl@0: //const TInt KPcm16FrameInterval = 371512; sl@0: //const TInt KPcm16FrameInterval = 278639; sl@0: // frame size is now variable, depending on the sample rate sl@0: //const TUint KFrameSize8K = 2048; // frame size for 8Khz sl@0: const TUint KFrameSize11K = 3072; // frame size for 11Khz sl@0: const TUint KPcmBitsPerSample8 = 8; sl@0: const TUint KPcmChannels = 1; sl@0: const TUint KSampleRate11K = 11025; sl@0: const TInt KPcm16FrameInterval = sl@0: (((KFrameSize11K * 1000000 / KSampleRate11K) / sl@0: KPcmBitsPerSample8 * KPcmChannels) sl@0: * 8); sl@0: sl@0: sl@0: const TInt KFixedSequenceCount = 6; sl@0: const TInt KMaxVolume = 65535; sl@0: sl@0: const TInt KMaxBalance = 100; sl@0: const TInt KMinBalance = -100; sl@0: const TInt KRecSize = 10000; sl@0: const TInt KToneFrequency = 880; sl@0: const TInt KToneFrequencyTwo = 1880; sl@0: const TInt KSoundFileLength = 8359183; sl@0: const TInt KInvalidNumber = 6234623; sl@0: sl@0: //pinched from MmfAudioInput.h: sl@0: const TUint KAudioInputMinFrameSize = 0x800; //2K sl@0: const TUint KAudioInputMaxFrameSize = 0x4000; //16K sl@0: const TUint KAudioInputDeltaFrameSize = 0x400; //1K sl@0: const TUint KAudioInputDefaultFrameSize = 0x1000; //4K sl@0: const TUint KAudioInputFramesPerSecond = 4; sl@0: //pinched from gsm610.h: sl@0: const TUint KGsmEncodedFrameSize = 65; sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: * @ TMmfAclntWavEncodeClipFormat, provides a class to support interfaces that require a sl@0: * @ TMdaClipFormat. sl@0: */ sl@0: const TUid KMmfUidEncodeFormatWAV = {KMmfUidFormatWAVWrite}; sl@0: class TMmfAclntWavEncodeClipFormat : public TMdaClipFormat sl@0: { sl@0: public: sl@0: inline TMmfAclntWavEncodeClipFormat(); sl@0: }; sl@0: inline TMmfAclntWavEncodeClipFormat::TMmfAclntWavEncodeClipFormat() : sl@0: TMdaClipFormat(KMmfUidEncodeFormatWAV,sizeof(TMmfAclntWavEncodeClipFormat)) {} sl@0: sl@0: /** sl@0: * @ TMmfAclntWavDecodeClipFormat, provides a class to support interfaces that require a sl@0: * @ TMdaClipFormat. sl@0: */ sl@0: const TUid KMmfUidDecodeFormatWAV = {KMmfUidFormatWAVRead}; sl@0: class TMmfAclntWavDecodeClipFormat : public TMdaClipFormat sl@0: { sl@0: public: sl@0: inline TMmfAclntWavDecodeClipFormat(); sl@0: }; sl@0: inline TMmfAclntWavDecodeClipFormat::TMmfAclntWavDecodeClipFormat() : sl@0: TMdaClipFormat(KMmfUidDecodeFormatWAV,sizeof(TMmfAclntWavDecodeClipFormat)) {} sl@0: sl@0: sl@0: /** sl@0: * @ MCallbackHandlerObserver, provides an Observer sl@0: * @ for monitoring callbacks. sl@0: */ sl@0: class MCallbackHandlerObserver sl@0: { sl@0: public: sl@0: virtual void MchoComplete(TInt aID, TInt aError)=0; sl@0: }; sl@0: sl@0: /** sl@0: * CCallbackHandler provides an Observer sl@0: * for monitoring MMdaAudioPlayerCallback callbacks. sl@0: * sl@0: * @ class CPlayerCallbackHandler sl@0: * sl@0: */ sl@0: class CPlayerCallbackHandler : public MMdaAudioPlayerCallback sl@0: { sl@0: public: sl@0: CPlayerCallbackHandler(const TInt aID, MCallbackHandlerObserver* aMchObserver) : iMchObserver(aMchObserver), iID(aID) {}; sl@0: TInt ID(); sl@0: sl@0: // from MMdaAudioPlayerCallback sl@0: virtual void MapcInitComplete(TInt aError, const TTimeIntervalMicroSeconds& aDuration); sl@0: virtual void MapcPlayComplete(TInt aError); sl@0: sl@0: private: sl@0: MCallbackHandlerObserver* iMchObserver; sl@0: TInt iID; sl@0: }; sl@0: sl@0: /** sl@0: * CCallbackHandler provides an Observer for sl@0: * monitoring MMdaObjectStateChangeObserver callbacks. sl@0: * sl@0: * @class CStateCallbackHandler sl@0: * sl@0: */ sl@0: class CStateCallbackHandler : public MMdaObjectStateChangeObserver sl@0: { sl@0: public: sl@0: CStateCallbackHandler(const TInt aID, MCallbackHandlerObserver* aMchObserver) : iMchObserver(aMchObserver), iID(aID) {}; sl@0: TInt ID(); sl@0: sl@0: // from MMdaObjectStateChangeObserver sl@0: virtual void MoscoStateChangeEvent(CBase* /*aObject*/, TInt /*aPreviousState*/, TInt /*aCurrentState*/, TInt aErrorCode); sl@0: sl@0: private: sl@0: MCallbackHandlerObserver* iMchObserver; sl@0: TInt iID; sl@0: }; sl@0: sl@0: sl@0: /** sl@0: * provides an Observer for monitoring MMdaAudioToneObserver callbacks. sl@0: * sl@0: * @class CToneCallbackHandler sl@0: * sl@0: */ sl@0: class CToneCallbackHandler : public MMdaAudioToneObserver sl@0: { sl@0: public: sl@0: CToneCallbackHandler(const TInt aID, MCallbackHandlerObserver* aMchObserver) : iMchObserver(aMchObserver), iID(aID) {}; sl@0: TInt ID(); sl@0: sl@0: // From MMdaAudioToneObserver sl@0: virtual void MatoPrepareComplete(TInt aError); sl@0: virtual void MatoPlayComplete(TInt aError); sl@0: sl@0: private: sl@0: MCallbackHandlerObserver* iMchObserver; sl@0: TInt iID; sl@0: }; sl@0: sl@0: /** sl@0: * sl@0: * CActiveListener provides the asynchronous operation sl@0: * of an active object sl@0: * sl@0: * @class CActiveListener sl@0: * sl@0: */ sl@0: class CActiveListener : public CActive sl@0: { sl@0: public: sl@0: CActiveListener(); sl@0: void InitialiseActiveListener(); sl@0: // From CActive sl@0: virtual void RunL(); sl@0: virtual void DoCancel() {}; sl@0: }; sl@0: sl@0: sl@0: /** sl@0: * It's a base class for all test steps. sl@0: * sl@0: * @class CTestMmfAclntStep sl@0: * @brief Test class that enables tests. sl@0: * sl@0: */ sl@0: class CTestMmfAclntStep : public CTestStep sl@0: { sl@0: public: sl@0: CTestMmfAclntStep(); sl@0: static void CleanUp(TAny *aPtr) ; sl@0: void SetTestSuite(const CTestSuite* aTestSuite ); sl@0: sl@0: protected: sl@0: void WaitWithTimeout(TRequestStatus& aStatus, TInt aNumberOfMicroSeconds); sl@0: TBool TimeComparison(const TUint aActual, const TUint aExpected, const TUint aDivation); sl@0: sl@0: // tests may optionally implement pre- and post-ambles sl@0: virtual TVerdict DoTestStepPreambleL(); sl@0: virtual TVerdict DoTestStepPostambleL(); sl@0: sl@0: protected: sl@0: const CTestSuite* iTestSuite ; sl@0: CActiveScheduler* iActiveScheduler; sl@0: }; sl@0: sl@0: /** sl@0: * Test base class that adds codec specific sl@0: * functionalty (applys to tests that create files). sl@0: * sl@0: * @class CTestMmfAclntCodecTest sl@0: * @codec specific test base class. sl@0: * sl@0: */ sl@0: class CTestMmfAclntCodecTest : public CTestMmfAclntStep sl@0: { sl@0: public: sl@0: enum TTestFormat sl@0: { sl@0: ENone, sl@0: EPcm16Wav, sl@0: EMulawRaw, sl@0: E16BitAu, sl@0: EAlawAu, sl@0: EPcm16Au, sl@0: EImaAdpcmWav, sl@0: EImasPcmWav, sl@0: EPcm8, sl@0: EPcmU8, sl@0: EPcmU16, sl@0: EAlawWav, sl@0: EEpocWve, sl@0: EGsmWav sl@0: }; sl@0: public: sl@0: void SetupFormatL(const TTestFormat aFormat); sl@0: TVerdict DoTestStepPostambleL(); sl@0: sl@0: protected: sl@0: TMdaClipFormat* iFormat; sl@0: TMdaPackage* iCodec; sl@0: TMdaAudioDataSettings iAudioSettings; sl@0: TTestFormat iTestFormat; sl@0: }; sl@0: sl@0: sl@0: TAny GetDriveName(TDes& aFileName); sl@0: const TInt KSizeBuf = 256; sl@0: sl@0: sl@0: #endif// TSI_MMFACLNT_H__ sl@0: