1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/mm/mmlibs/mmfw/tsrc/mmfintegrationtest/ACLNT/TestTone.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,1171 @@
1.4 +// Copyright (c) 2002-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 +// This program is designed the test of the MMF_ACLNT.
1.18 +//
1.19 +//
1.20 +
1.21 +/**
1.22 + @file TestTone.cpp
1.23 +*/
1.24 +
1.25 +
1.26 +#include "TestTone.h"
1.27 +
1.28 +const TInt KHeapSizeToneTestEKA2 = 128000; // Heapsize for tone tests on EKA2
1.29 +
1.30 +/**
1.31 + * Constructor
1.32 + */
1.33 +CTestMmfAclntTone::CTestMmfAclntTone(const TDesC& aTestName, const TInt aExpectedResult)
1.34 + {
1.35 + // store the name of this test case
1.36 + // this is the name that is used by the script file
1.37 + // Each test step initialises it's own name
1.38 + iTestStepName = aTestName;
1.39 +
1.40 +// need a bigger heap size on EKA2 HW
1.41 +#if !defined __WINS__
1.42 + iHeapSize = KHeapSizeToneTestEKA2;
1.43 +#endif // EKA2
1.44 +
1.45 + iFrequency = KToneFrequency;
1.46 + iDuration = TTimeIntervalMicroSeconds(KOneSecond);
1.47 + iExpectedResult = aExpectedResult;
1.48 + iStop = ETrue;
1.49 + }
1.50 +
1.51 +CTestMmfAclntTone* CTestMmfAclntTone::NewL(const TDesC& aTestName, const TInt aExpectedResult)
1.52 + {
1.53 + CTestMmfAclntTone* self = new (ELeave) CTestMmfAclntTone(aTestName,aExpectedResult);
1.54 + return self;
1.55 + }
1.56 +
1.57 +void CTestMmfAclntTone::MatoPrepareComplete(TInt aError)
1.58 + {
1.59 + iError = aError;
1.60 + INFO_PRINTF1( _L("CTestMmfAclntTone::MatoPrepareComplete MMdaAudioToneObserver Callback for CMdaAudioToneUtility complete"));
1.61 + INFO_PRINTF2( _L("iError %d"), iError);
1.62 + if(iStop)
1.63 + CActiveScheduler::Stop();
1.64 + }
1.65 +
1.66 +void CTestMmfAclntTone::MatoPlayComplete(TInt aError)
1.67 + {
1.68 + iError = aError;
1.69 + INFO_PRINTF1( _L("CTestMmfAclntTone::MatoPlayComplete MMdaAudioToneObserver Callback for CMdaAudioToneUtility complete"));
1.70 + INFO_PRINTF2( _L("iError %d"), iError);
1.71 + if(iStop)
1.72 + CActiveScheduler::Stop();
1.73 + }
1.74 +
1.75 +/**
1.76 + * Play a tone
1.77 + */
1.78 +TVerdict CTestMmfAclntTone::DoTestStepL()
1.79 + {
1.80 + INFO_PRINTF1( _L("TestTone : Play"));
1.81 +
1.82 + iStop = ETrue;
1.83 + TVerdict ret = EFail;
1.84 + iError = KErrTimedOut;
1.85 +
1.86 + CMdaAudioToneUtility* toneUtil = CMdaAudioToneUtility::NewL(*this);
1.87 + CleanupStack::PushL(toneUtil);
1.88 + toneUtil->PrepareToPlayTone(iFrequency,iDuration);
1.89 + // Wait for prepare
1.90 + INFO_PRINTF1( _L("Initialise CMdaAudioToneUtility"));
1.91 + CActiveScheduler::Start();
1.92 +
1.93 + if(iError == KErrNone)
1.94 + ret = DoTestL(toneUtil);
1.95 +
1.96 + //produce another tone to confirm that the configuration is retained over multiple plays
1.97 + if(iError == KErrNone)
1.98 + ret = DoTestL(toneUtil);
1.99 +
1.100 + if(ret == EFail)
1.101 + ERR_PRINTF2( _L("CMdaAudioToneUtility failed with error %d"),iError );
1.102 +
1.103 + CleanupStack::PopAndDestroy(toneUtil);
1.104 + return ret;
1.105 + }
1.106 +
1.107 +TVerdict CTestMmfAclntTone::DoTestL(CMdaAudioToneUtility* aToneUtil)
1.108 + {
1.109 + TVerdict ret = EFail;
1.110 + iError = KErrTimedOut;
1.111 +
1.112 + aToneUtil->Play();
1.113 + // wait for play.
1.114 + INFO_PRINTF1( _L("Play CMdaAudioToneUtility"));
1.115 + CActiveScheduler::Start();
1.116 +
1.117 + if(iError == iExpectedResult)
1.118 + ret = EPass;
1.119 +
1.120 + return ret;
1.121 + }
1.122 +
1.123 +//------------------------------------------------------------------
1.124 +
1.125 +//Play DualTone Test for Sirocco CR
1.126 +CTestMmfAclntDualTone::CTestMmfAclntDualTone(const TDesC& aTestName)
1.127 + : CTestMmfAclntTone(aTestName)
1.128 + {
1.129 + iFreqOne = KToneFrequency;
1.130 + iFreqTwo = KToneFrequencyTwo;
1.131 + }
1.132 +
1.133 +CTestMmfAclntDualTone* CTestMmfAclntDualTone::NewL(const TDesC& aTestName)
1.134 + {
1.135 + CTestMmfAclntDualTone* self = new (ELeave) CTestMmfAclntDualTone(aTestName);
1.136 + return self;
1.137 + }
1.138 +
1.139 +
1.140 +/**
1.141 + * Play a Dual tone
1.142 + */
1.143 +
1.144 +TVerdict CTestMmfAclntDualTone::DoTestStepL()
1.145 + {
1.146 + INFO_PRINTF1( _L("TestTone : Play Dual Tone"));
1.147 +
1.148 + TVerdict ret = EFail;
1.149 + iError = KErrTimedOut;
1.150 +
1.151 + CMdaAudioToneUtility* toneUtil = CMdaAudioToneUtility::NewL(*this);
1.152 + CleanupStack::PushL(toneUtil);
1.153 + toneUtil->PrepareToPlayDualTone(iFreqOne,iFreqTwo,iDuration);
1.154 +
1.155 + // Wait for prepare
1.156 + INFO_PRINTF1( _L("Initialise CMdaAudioToneUtility"));
1.157 + CActiveScheduler::Start();
1.158 +
1.159 + if(iError == KErrNone)
1.160 + ret = DoTestL(toneUtil);
1.161 +
1.162 + //produce another tone to confirm that the configuration is retained over multiple plays
1.163 + if(iError == KErrNone)
1.164 + ret = DoTestL(toneUtil);
1.165 +
1.166 + if(ret == EFail)
1.167 + ERR_PRINTF2( _L("CMdaAudioToneUtility failed with error %d"),iError );
1.168 +
1.169 + CleanupStack::PopAndDestroy(toneUtil);
1.170 + return ret;
1.171 + }
1.172 +
1.173 +//------------------------------------------------------------------
1.174 +
1.175 +
1.176 +CTestMmfAclntToneDtmf::CTestMmfAclntToneDtmf(const TDesC& aTestName,const TDesC& aDTMF,const TInt aExpectedResult)
1.177 + : CTestMmfAclntTone(aTestName,aExpectedResult), iDTMF(aDTMF)
1.178 + {}
1.179 +
1.180 +CTestMmfAclntToneDtmf* CTestMmfAclntToneDtmf::NewL(const TDesC& aTestName,const TDesC& aDTMF,const TInt aExpectedResult)
1.181 + {
1.182 + CTestMmfAclntToneDtmf* self = new (ELeave) CTestMmfAclntToneDtmf(aTestName,aDTMF,aExpectedResult);
1.183 + return self;
1.184 + }
1.185 +
1.186 +/**
1.187 + * Play a DTMF string
1.188 + */
1.189 +TVerdict CTestMmfAclntToneDtmf::DoTestStepL()
1.190 + {
1.191 + INFO_PRINTF1( _L("TestTone : Play DTMF"));
1.192 +
1.193 + TVerdict ret = EFail;
1.194 + iError = KErrTimedOut;
1.195 +
1.196 + CMdaAudioToneUtility* toneUtil = CMdaAudioToneUtility::NewL(*this);
1.197 + CleanupStack::PushL(toneUtil);
1.198 + toneUtil->PrepareToPlayDTMFString(iDTMF);
1.199 + // Wait for prepare to complete
1.200 + INFO_PRINTF1( _L("Initialise CMdaAudioToneUtility"));
1.201 + CActiveScheduler::Start();
1.202 +
1.203 + toneUtil->PrepareToPlayDTMFString(iDTMF);
1.204 + // Wait for prepare to complete
1.205 + INFO_PRINTF1( _L("Reinitialise CMdaAudioToneUtility"));
1.206 + CActiveScheduler::Start();
1.207 +
1.208 + if(iError == KErrNone)
1.209 + ret = DoTestL(toneUtil);
1.210 + else if (iError == iExpectedResult)
1.211 + {
1.212 + INFO_PRINTF2( _L("Initialisation failed as expected with code %d"), iError);
1.213 + ret = EPass;
1.214 + iError = KErrNone;
1.215 + }
1.216 +
1.217 + if(ret == EFail)
1.218 + ERR_PRINTF2( _L("CMdaAudioToneUtility failed with error %d"),iError );
1.219 +
1.220 + CleanupStack::PopAndDestroy(toneUtil);
1.221 + return ret;
1.222 + }
1.223 +
1.224 +//------------------------------------------------------------------
1.225 +
1.226 +/**
1.227 + * Constructor
1.228 + */
1.229 +CTestMmfAclntToneFile::CTestMmfAclntToneFile(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName)
1.230 + : CTestMmfAclntTone(aTestName)
1.231 + {
1.232 + // store the name of this test case
1.233 + // this is the name that is used by the script file
1.234 + // Each test step initialises it's own name
1.235 + iSectName = aSectName;
1.236 + iKeyName= aKeyName;
1.237 + }
1.238 +
1.239 +CTestMmfAclntToneFile* CTestMmfAclntToneFile::NewL(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName)
1.240 + {
1.241 + CTestMmfAclntToneFile* self = new (ELeave) CTestMmfAclntToneFile(aTestName,aSectName,aKeyName);
1.242 + return self;
1.243 + }
1.244 +
1.245 +TVerdict CTestMmfAclntToneFile::DoTestStepPreambleL()
1.246 + {
1.247 + TPtrC filename;
1.248 + if(!GetStringFromConfig(iSectName, iKeyName, filename))
1.249 + return EInconclusive;
1.250 +
1.251 + // Create a sequence file
1.252 + TInt length;
1.253 + RFs fs;
1.254 +
1.255 + fs.Connect();
1.256 + CleanupClosePushL(fs);
1.257 +#ifdef __IPC_V2_PRESENT__
1.258 + User::LeaveIfError(fs.ShareAuto());
1.259 +#else
1.260 + User::LeaveIfError(fs.Share(RSessionBase::EExplicitAttach));
1.261 +#endif
1.262 + RFile file;
1.263 + User::LeaveIfError(file.Replace(fs,filename,EFileWrite));
1.264 + CleanupClosePushL(file);
1.265 + User::LeaveIfError(file.Write(KFixedSequenceData()));
1.266 + User::LeaveIfError(file.Size(length));
1.267 + CleanupStack::PopAndDestroy(2, &fs);
1.268 +
1.269 + return CTestMmfAclntStep::DoTestStepPreambleL();
1.270 + }
1.271 +
1.272 +/**
1.273 + * Play a tone file
1.274 + */
1.275 +TVerdict CTestMmfAclntToneFile::DoTestStepL( void )
1.276 + {
1.277 + INFO_PRINTF1( _L("TestTone : Play File"));
1.278 +
1.279 + TVerdict ret = EFail;
1.280 +
1.281 +
1.282 + TPtrC filename;
1.283 + if(!GetStringFromConfig(iSectName, iKeyName, filename))
1.284 + return EInconclusive;
1.285 +
1.286 + iError = KErrTimedOut;
1.287 + // perform test using this file
1.288 + CMdaAudioToneUtility* toneUtil = CMdaAudioToneUtility::NewL(*this);
1.289 + CleanupStack::PushL(toneUtil);
1.290 + toneUtil->PrepareToPlayFileSequence(filename);
1.291 + // Wait for prepare
1.292 + INFO_PRINTF1( _L("Initialise CMdaAudioToneUtility"));
1.293 + CActiveScheduler::Start();
1.294 +
1.295 + toneUtil->PrepareToPlayFileSequence(filename);
1.296 + // Wait for prepare
1.297 + INFO_PRINTF1( _L("re-initialise CMdaAudioToneUtility"));
1.298 + CActiveScheduler::Start();
1.299 +
1.300 + if(iError == KErrNone)
1.301 + ret = DoTestL(toneUtil);
1.302 +
1.303 + if(ret == EFail)
1.304 + ERR_PRINTF2( _L("CMdaAudioToneUtility failed with error %d"),iError );
1.305 +
1.306 + CleanupStack::PopAndDestroy(toneUtil);
1.307 + return ret;
1.308 + }
1.309 +
1.310 +//------------------------------------------------------------------
1.311 +
1.312 +/**
1.313 + * Constructor
1.314 + */
1.315 +CTestMmfAclntToneDes::CTestMmfAclntToneDes(const TDesC& aTestName, const TDesC8& aDes, const TInt aExpectedResult)
1.316 + : CTestMmfAclntTone(aTestName, aExpectedResult), iDes(aDes)
1.317 + {}
1.318 +
1.319 +CTestMmfAclntToneDes* CTestMmfAclntToneDes::NewL(const TDesC& aTestName, const TDesC8& aDes, const TInt aExpectedResult)
1.320 + {
1.321 + CTestMmfAclntToneDes* self = new (ELeave) CTestMmfAclntToneDes(aTestName,aDes, aExpectedResult);
1.322 + return self;
1.323 + }
1.324 +
1.325 +/**
1.326 + * Play a tone from a descriptor.
1.327 + */
1.328 +TVerdict CTestMmfAclntToneDes::DoTestStepL()
1.329 + {
1.330 + INFO_PRINTF1( _L("TestTone : Play Des"));
1.331 +
1.332 + TVerdict ret = EFail;
1.333 + iError = KErrTimedOut;
1.334 +
1.335 + CMdaAudioToneUtility* toneUtil = CMdaAudioToneUtility::NewL(*this);
1.336 + CleanupStack::PushL(toneUtil);
1.337 + toneUtil->PrepareToPlayDesSequence(iDes);
1.338 + // Wait for prepare
1.339 + INFO_PRINTF1( _L("Initialise CMdaAudioToneUtility"));
1.340 + CActiveScheduler::Start();
1.341 +
1.342 + toneUtil->PrepareToPlayDesSequence(iDes);
1.343 + // Wait for prepare
1.344 + INFO_PRINTF1( _L("re-initialise CMdaAudioToneUtility"));
1.345 + CActiveScheduler::Start();
1.346 +
1.347 + if(iError == KErrNone)
1.348 + ret = DoTestL(toneUtil);
1.349 +
1.350 + if(ret == EFail)
1.351 + ERR_PRINTF2( _L("CMdaAudioToneUtility failed with error %d"),iError );
1.352 +
1.353 + CleanupStack::PopAndDestroy(toneUtil);
1.354 + return ret;
1.355 + }
1.356 +
1.357 +//------------------------------------------------------------------
1.358 +
1.359 +/**
1.360 + * Constructor
1.361 + */
1.362 +CTestMmfAclntToneFixed::CTestMmfAclntToneFixed(const TDesC& aTestName,const TInt aTone)
1.363 + :CTestMmfAclntTone(aTestName), iTone(aTone)
1.364 + {}
1.365 +
1.366 +CTestMmfAclntToneFixed* CTestMmfAclntToneFixed::NewL(const TDesC& aTestName,const TInt aTone)
1.367 + {
1.368 + CTestMmfAclntToneFixed* self = new (ELeave) CTestMmfAclntToneFixed(aTestName,aTone);
1.369 + return self;
1.370 + }
1.371 +
1.372 +/**
1.373 + * Play a predefined/fixed tone
1.374 + */
1.375 +TVerdict CTestMmfAclntToneFixed::DoTestStepL()
1.376 + {
1.377 + #ifdef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
1.378 + INFO_PRINTF1( _L("TestTone : Play Fixed - no longer supported"));
1.379 +
1.380 + TVerdict ret = EFail;
1.381 + iError = KErrTimedOut;
1.382 +
1.383 + CMdaAudioToneUtility* toneUtil = CMdaAudioToneUtility::NewL(*this);
1.384 + CleanupStack::PushL(toneUtil);
1.385 + toneUtil->PrepareToPlayFixedSequence(iTone);
1.386 + // Wait for prepare
1.387 + INFO_PRINTF1( _L("Initialise CMdaAudioToneUtility"));
1.388 + CActiveScheduler::Start();
1.389 +
1.390 + toneUtil->PrepareToPlayFixedSequence(iTone);
1.391 + // Wait for prepare
1.392 + INFO_PRINTF1( _L("re-initialise CMdaAudioToneUtility"));
1.393 + CActiveScheduler::Start();
1.394 +
1.395 + // Has Audio Utility intialisied ?
1.396 + TInt sequenceCount = toneUtil->FixedSequenceCount();
1.397 + INFO_PRINTF2( _L("FixedSequenceCount() returned %d"),sequenceCount);
1.398 + if(sequenceCount <= 0)
1.399 + {
1.400 + INFO_PRINTF1( _L("Play Fixed Sequence is no longer supported"));
1.401 + ret = EPass;
1.402 + }
1.403 +
1.404 + if(ret == EFail)
1.405 + ERR_PRINTF2( _L("CMdaAudioToneUtility failed with error %d"),iError );
1.406 +
1.407 + CleanupStack::PopAndDestroy(toneUtil);
1.408 + return ret;
1.409 +
1.410 + #else
1.411 + INFO_PRINTF1( _L("TestTone : Play Fixed"));
1.412 +
1.413 + TVerdict ret = EFail;
1.414 + iError = KErrTimedOut;
1.415 +
1.416 + CMdaAudioToneUtility* toneUtil = CMdaAudioToneUtility::NewL(*this);
1.417 + CleanupStack::PushL(toneUtil);
1.418 + toneUtil->PrepareToPlayFixedSequence(iTone);
1.419 + // Wait for prepare
1.420 + INFO_PRINTF1( _L("Initialise CMdaAudioToneUtility"));
1.421 + CActiveScheduler::Start();
1.422 +
1.423 + toneUtil->PrepareToPlayFixedSequence(iTone);
1.424 + // Wait for prepare
1.425 + INFO_PRINTF1( _L("re-initialise CMdaAudioToneUtility"));
1.426 + CActiveScheduler::Start();
1.427 +
1.428 + // Has Audio Utility intialisied ?
1.429 + TInt sequenceCount = toneUtil->FixedSequenceCount() ;
1.430 + if((iError == KErrNone) && (sequenceCount > 0))
1.431 + {
1.432 + INFO_PRINTF2( _L("FixedSequenceName is %S"), &toneUtil->FixedSequenceName(sequenceCount - 1)) ;
1.433 + ret = DoTestL(toneUtil);
1.434 + }
1.435 +
1.436 + if(ret == EFail)
1.437 + ERR_PRINTF2( _L("CMdaAudioToneUtility failed with error %d"),iError );
1.438 +
1.439 + CleanupStack::PopAndDestroy(toneUtil);
1.440 + return ret;
1.441 + #endif
1.442 + }
1.443 +//------------------------------------------------------------------
1.444 +
1.445 +/**
1.446 + * Constructor
1.447 + */
1.448 +CTestMmfAclntToneAudio::CTestMmfAclntToneAudio()
1.449 + {
1.450 + // store the name of this test case
1.451 + // this is the name that is used by the script file
1.452 + // Each test step initialises it's own name
1.453 + iTestStepName = _L("MM-MMF-ACLNT-I-0156-LP");
1.454 +
1.455 +// this test does not inherit from CTestMmfAclntTone
1.456 +// so we need to make the heap bigger here
1.457 +// need a bigger heap size on EKA2 HW
1.458 +#if !defined __WINS__
1.459 + iHeapSize = KHeapSizeToneTestEKA2;
1.460 +#endif // EKA2
1.461 + }
1.462 +
1.463 +void CTestMmfAclntToneAudio::MatoPrepareComplete(TInt aError)
1.464 + {
1.465 + iToneError = aError;
1.466 + INFO_PRINTF1( _L("CTestMmfAclntToneAudio::MatoPrepareComplete MMdaAudioToneObserver Callback for CMdaAudioToneUtility complete"));
1.467 + INFO_PRINTF2( _L("iToneError %d"), iToneError);
1.468 + CActiveScheduler::Stop();
1.469 + }
1.470 +
1.471 +void CTestMmfAclntToneAudio::MatoPlayComplete(TInt aError)
1.472 + {
1.473 + INFO_PRINTF1( _L("CTestMmfAclntToneAudio::MatoPlayComplete MMdaAudioToneObserver Callback for CMdaAudioToneUtility called"));
1.474 + iToneError = aError;
1.475 + INFO_PRINTF2( _L("iToneError %d"), iToneError);
1.476 +
1.477 + if((--iCallbackCount) == 0)
1.478 + CActiveScheduler::Stop();
1.479 + }
1.480 +
1.481 +void CTestMmfAclntToneAudio::MapcInitComplete(TInt aError, const TTimeIntervalMicroSeconds& /*aDuration*/)
1.482 + {
1.483 + iPlayerError = aError;
1.484 + CActiveScheduler::Stop();
1.485 + }
1.486 +
1.487 +void CTestMmfAclntToneAudio::MapcPlayComplete(TInt aError)
1.488 + {
1.489 + INFO_PRINTF1( _L("CTestMmfAclntToneAudio::MatcPlayComplete MMdaAudioPlayerCallback for CMdaAudioPlayerUtility called"));
1.490 + iPlayerError = aError;
1.491 + INFO_PRINTF2( _L("iPlayerError %d"), iPlayerError);
1.492 +
1.493 + if((--iCallbackCount) == 0)
1.494 + CActiveScheduler::Stop();
1.495 + }
1.496 +
1.497 +//------------------------------------------------------------------
1.498 +
1.499 +/**
1.500 + * Playing a tone and playing an audio file.
1.501 + */
1.502 +TVerdict CTestMmfAclntToneAudio::DoTestStepL( void )
1.503 + {
1.504 + INFO_PRINTF1( _L("TestTone : Tone/File"));
1.505 +
1.506 + TBuf<KSizeBuf> filename;
1.507 + TPtrC filename1;
1.508 + if(!GetStringFromConfig(_L("SectionOne"), _L("playerAudioFile"), filename1))
1.509 + return EInconclusive;
1.510 +
1.511 + GetDriveName(filename);
1.512 + filename.Append(filename1);
1.513 +
1.514 + iPlayerError = KErrTimedOut;
1.515 + CMdaAudioPlayerUtility* playerUtility =
1.516 + //CMdaAudioPlayerUtility::NewFilePlayerL(filename,*this);//, EPriorityHigh);
1.517 + CMdaAudioPlayerUtility::NewFilePlayerL(filename,*this, EPriorityNormal);
1.518 +
1.519 + CleanupStack::PushL(playerUtility);
1.520 +
1.521 + // Wait for prepare
1.522 + INFO_PRINTF1( _L("Initialise CMdaAudioPlayerUtility"));
1.523 + CActiveScheduler::Start();
1.524 +
1.525 + if(iPlayerError == KErrNone)
1.526 + {
1.527 + iToneError = KErrTimedOut;
1.528 + INFO_PRINTF1( _L("Create audio tone utility..."));
1.529 + CMdaAudioToneUtility* toneUtil = CMdaAudioToneUtility::NewL(*this);
1.530 + CleanupStack::PushL(toneUtil);
1.531 +
1.532 + INFO_PRINTF1( _L("Prepare to play tone..."));
1.533 + toneUtil->PrepareToPlayTone(KToneFrequency,TTimeIntervalMicroSeconds(KOneSecond));
1.534 + // Wait for prepare
1.535 + INFO_PRINTF1( _L("Initialise CMdaAudioToneUtility"));
1.536 + CActiveScheduler::Start();
1.537 +
1.538 + INFO_PRINTF1( _L("Re-prepare to play tone..."));
1.539 + toneUtil->PrepareToPlayTone(KToneFrequency,TTimeIntervalMicroSeconds(KOneSecond));
1.540 + // Wait for prepare
1.541 + INFO_PRINTF1( _L("Initialise CMdaAudioToneUtility"));
1.542 + CActiveScheduler::Start();
1.543 +
1.544 + toneUtil->SetPriority(EPriorityHigh, EMdaPriorityPreferenceNone);
1.545 + if(iToneError == KErrNone)
1.546 + {
1.547 + iPlayerError = KErrTimedOut;
1.548 + iToneError = KErrTimedOut;
1.549 +
1.550 + // play files together
1.551 + INFO_PRINTF1( _L("Play CMdaAudioPlayerUtility"));
1.552 + playerUtility->Play();
1.553 + INFO_PRINTF1( _L("Play CMdaAudioToneUtility"));
1.554 + toneUtil->Play();
1.555 +
1.556 + iCallbackCount = 2;
1.557 + CActiveScheduler::Start();
1.558 + // Wait for two callbacks
1.559 +
1.560 + //Tone utility is at priority high - should complete normally
1.561 + //Player is at priority normal should complete with KErrInUse
1.562 + //KErrAccessDenied is OK here, at least until we can do Mixing
1.563 + if(iToneError==KErrNone && (iPlayerError==KErrInUse || iPlayerError==KErrNone))
1.564 + {
1.565 + CleanupStack::PopAndDestroy(2); // playerUtility, toneUtil
1.566 + return EPass;
1.567 + }
1.568 + }
1.569 + CleanupStack::PopAndDestroy(toneUtil);
1.570 + }
1.571 + else
1.572 + INFO_PRINTF1( _L("Cannot initialise CMdaAudioPlayerUtility"));
1.573 +
1.574 + ERR_PRINTF2( _L("CMdaAudioToneUtility completed with player error %d"),iPlayerError );
1.575 + ERR_PRINTF2( _L("CMdaAudioToneUtility completed with tone error %d"),iToneError );
1.576 + CleanupStack::PopAndDestroy(playerUtility);
1.577 + return EFail;
1.578 + }
1.579 +
1.580 +//------------------------------------------------------------------
1.581 +
1.582 +/** Constructor
1.583 + */
1.584 +CTestMmfAclntToneCancelP::CTestMmfAclntToneCancelP(const TDesC& aTestName)
1.585 + :CTestMmfAclntTone(aTestName)
1.586 + {}
1.587 +
1.588 +CTestMmfAclntToneCancelP* CTestMmfAclntToneCancelP::NewL(const TDesC& aTestName)
1.589 + {
1.590 + CTestMmfAclntToneCancelP* self = new (ELeave) CTestMmfAclntToneCancelP(aTestName);
1.591 + return self;
1.592 + }
1.593 +
1.594 +/**
1.595 + * Cancel tone play
1.596 + */
1.597 +TVerdict CTestMmfAclntToneCancelP::DoTestL(CMdaAudioToneUtility* aToneUtil)
1.598 + {
1.599 + INFO_PRINTF1( _L("TestTone : Cancel Play"));
1.600 +
1.601 + iStop = EFalse;
1.602 + TVerdict ret = EFail;
1.603 +
1.604 + aToneUtil->Play();
1.605 + INFO_PRINTF1( _L("Play CMdaAudioToneUtility"));
1.606 + if(aToneUtil->State() == EMdaAudioToneUtilityPlaying)
1.607 + {
1.608 + // cancel play.
1.609 + INFO_PRINTF1( _L("Cancel Play CMdaAudioToneUtility"));
1.610 + aToneUtil->CancelPlay();
1.611 + // make sure tone is no longer playing
1.612 + if(aToneUtil->State() != EMdaAudioToneUtilityPlaying)
1.613 + ret = EPass;
1.614 + }
1.615 + return ret;
1.616 + }
1.617 +
1.618 +//------------------------------------------------------------------
1.619 +/**
1.620 + * Constructor
1.621 + */
1.622 +CTestMmfAclntToneCancelIni::CTestMmfAclntToneCancelIni(const TDesC& aTestName)
1.623 + :CTestMmfAclntTone(aTestName)
1.624 + {}
1.625 +
1.626 +CTestMmfAclntToneCancelIni* CTestMmfAclntToneCancelIni::NewL(const TDesC& aTestName)
1.627 + {
1.628 + CTestMmfAclntToneCancelIni* self = new (ELeave) CTestMmfAclntToneCancelIni(aTestName);
1.629 + return self;
1.630 + }
1.631 +
1.632 +/**
1.633 + * Cancel tone prepare.
1.634 + *
1.635 + * This fucntion cannot leave
1.636 + */
1.637 +TVerdict CTestMmfAclntToneCancelIni::DoTestStepL()
1.638 + {
1.639 + INFO_PRINTF1( _L("TestTone : Cancel Prepare"));
1.640 +
1.641 + TVerdict ret = EFail;
1.642 + iError = KErrTimedOut;
1.643 +
1.644 + CMdaAudioToneUtility* toneUtil = CMdaAudioToneUtility::NewL(*this);
1.645 + CleanupStack::PushL(toneUtil);
1.646 + INFO_PRINTF1( _L("Initialise CMdaAudioToneUtility"));
1.647 + toneUtil->PrepareToPlayFixedSequence(0);
1.648 + INFO_PRINTF1( _L("Cancel Prep CMdaAudioToneUtility"));
1.649 + toneUtil->CancelPrepare();
1.650 + // make sure init callback did not complete
1.651 + if((iError == KErrTimedOut) && (toneUtil->State() != EMdaAudioToneUtilityPrepared))
1.652 + ret = EPass;
1.653 +
1.654 + if(ret == EFail)
1.655 + ERR_PRINTF2( _L("CMdaAudioToneUtility failed with error %d"),iError );
1.656 +
1.657 + CleanupStack::PopAndDestroy(toneUtil);
1.658 + return ret;
1.659 + }
1.660 +
1.661 +//------------------------------------------------------------------
1.662 +
1.663 +/**
1.664 + * Constructor
1.665 + */
1.666 +CTestMmfAclntToneNames::CTestMmfAclntToneNames(const TDesC& aTestName)
1.667 + :CTestMmfAclntToneFixed(aTestName,1)
1.668 + {}
1.669 +
1.670 +CTestMmfAclntToneNames* CTestMmfAclntToneNames::NewL(const TDesC& aTestName)
1.671 + {
1.672 + CTestMmfAclntToneNames* self = new (ELeave) CTestMmfAclntToneNames(aTestName);
1.673 + return self;
1.674 + }
1.675 +
1.676 +/**
1.677 + * Enquire sequence name
1.678 + *
1.679 + * This function cannot leave
1.680 + */
1.681 +TVerdict CTestMmfAclntToneNames::DoTestL(CMdaAudioToneUtility* aToneUtil)
1.682 + {
1.683 + INFO_PRINTF1( _L("TestTone : Seq Name"));
1.684 +
1.685 + TVerdict ret = EPass;
1.686 + TBuf<32> seqName;
1.687 + TInt count = aToneUtil->FixedSequenceCount();
1.688 +
1.689 + for(TInt i = 0; i < count; i++)
1.690 + {
1.691 + seqName = aToneUtil->FixedSequenceName(i);
1.692 + if(seqName.Length() < 1)
1.693 + {
1.694 + ret = EFail;
1.695 + break;
1.696 + }
1.697 + }
1.698 + return ret;
1.699 + }
1.700 +
1.701 +//------------------------------------------------------------------
1.702 +
1.703 +/**
1.704 + * Constructor
1.705 + */
1.706 +CTestMmfAclntToneCount::CTestMmfAclntToneCount(const TDesC& aTestName)
1.707 + :CTestMmfAclntToneFixed(aTestName,1)
1.708 + {}
1.709 +
1.710 +CTestMmfAclntToneCount* CTestMmfAclntToneCount::NewL(const TDesC& aTestName)
1.711 + {
1.712 + CTestMmfAclntToneCount* self = new (ELeave) CTestMmfAclntToneCount(aTestName);
1.713 + return self;
1.714 + }
1.715 +
1.716 +/**
1.717 + * Enquire sequence count
1.718 + */
1.719 +TVerdict CTestMmfAclntToneCount::DoTestL(CMdaAudioToneUtility* aToneUtil)
1.720 + {
1.721 + INFO_PRINTF1( _L("TestTone : Seq Count"));
1.722 +
1.723 + iError = KErrTimedOut;
1.724 +
1.725 + if(aToneUtil->FixedSequenceCount() == KFixedSequenceCount)
1.726 + return EPass;
1.727 +
1.728 + return EFail ;
1.729 + }
1.730 +
1.731 +//------------------------------------------------------------------
1.732 +
1.733 +/**
1.734 + * Constructor
1.735 + */
1.736 +CTestMmfAclntToneVolume::CTestMmfAclntToneVolume(const TDesC& aTestName,const TInt aVolume)
1.737 + :CTestMmfAclntTone(aTestName), iVolume(aVolume)
1.738 + {}
1.739 +
1.740 +CTestMmfAclntToneVolume* CTestMmfAclntToneVolume::NewL(const TDesC& aTestName,const TInt aVolume)
1.741 + {
1.742 + CTestMmfAclntToneVolume* self = new (ELeave) CTestMmfAclntToneVolume(aTestName,aVolume);
1.743 + return self;
1.744 + }
1.745 +
1.746 +/**
1.747 + * Set volume to max and enquire volume
1.748 + */
1.749 +TVerdict CTestMmfAclntToneVolume::DoTestL(CMdaAudioToneUtility* aToneUtil)
1.750 + {
1.751 + INFO_PRINTF1( _L("TestTone : Volume"));
1.752 +
1.753 + TVerdict ret = EFail;
1.754 +
1.755 + // added from CTestMmfAclntTone : we need the device to be open before
1.756 + // SetVolume() will function correctly
1.757 +
1.758 + aToneUtil->Play();
1.759 + // wait for play.
1.760 + INFO_PRINTF1( _L("Play CMdaAudioToneUtility"));
1.761 +
1.762 + // don't wait for it to finish - run this test while playing
1.763 + // so we know device is open
1.764 +
1.765 + // Check maxvolume function
1.766 + if(iVolume == -1)
1.767 + {
1.768 + iVolume = aToneUtil->MaxVolume();
1.769 + aToneUtil->SetVolume(iVolume);
1.770 + INFO_PRINTF3(_L("volume = %d iVolume = %d"), aToneUtil->Volume(), iVolume);
1.771 + if(aToneUtil->Volume() == iVolume)
1.772 + ret = EPass;
1.773 + }
1.774 + // Volume is truncated to maxvolume
1.775 + if(iVolume > aToneUtil->MaxVolume())
1.776 + {
1.777 + aToneUtil->SetVolume(iVolume);
1.778 + INFO_PRINTF3(_L("volume = %d maxVolume = %d"), aToneUtil->Volume(), aToneUtil->MaxVolume());
1.779 + if(aToneUtil->Volume() == aToneUtil->MaxVolume())
1.780 + ret = EPass;
1.781 + }
1.782 + // Volume is truncated to 0
1.783 + else if(iVolume < 0)
1.784 + {
1.785 + aToneUtil->SetVolume(iVolume);
1.786 + INFO_PRINTF2(_L("volume = %d, expecting 0"), aToneUtil->Volume());
1.787 + if(aToneUtil->Volume() == 0)
1.788 + ret = EPass;
1.789 + }
1.790 + // Set volume and check
1.791 + else
1.792 + {
1.793 + aToneUtil->SetVolume(iVolume);
1.794 + INFO_PRINTF3(_L("volume = %d iVolume = %d"), aToneUtil->Volume(), iVolume);
1.795 + if(aToneUtil->Volume() == iVolume)
1.796 + ret = EPass;
1.797 + }
1.798 +
1.799 + // let it finish playing
1.800 + CActiveScheduler::Start();
1.801 +
1.802 + return ret;
1.803 + }
1.804 +
1.805 +
1.806 +//------------------------------------------------------------------
1.807 +
1.808 +/**
1.809 + * Constructor
1.810 + */
1.811 +CTestMmfAclntVolumeRamp::CTestMmfAclntVolumeRamp(const TDesC& aTestName, const TInt aRamp)
1.812 + :CTestMmfAclntTone(aTestName), iRamp(aRamp)
1.813 + {}
1.814 +
1.815 +CTestMmfAclntVolumeRamp* CTestMmfAclntVolumeRamp::NewL(const TDesC& aTestName, const TInt aRamp)
1.816 + {
1.817 + CTestMmfAclntVolumeRamp* self = new (ELeave) CTestMmfAclntVolumeRamp(aTestName,aRamp);
1.818 + return self;
1.819 + }
1.820 +
1.821 +/**
1.822 + * Set volume ramp
1.823 + * This function cannot leave
1.824 + */
1.825 +TVerdict CTestMmfAclntVolumeRamp::DoTestL(CMdaAudioToneUtility* aToneUtil)
1.826 + {
1.827 +
1.828 + INFO_PRINTF1( _L("TestTone : Ramp"));
1.829 +
1.830 + TTimeIntervalMicroSeconds ramp(iRamp);
1.831 + aToneUtil->SetVolumeRamp(ramp);
1.832 +
1.833 + // aToneUtil->[Get]VolumeRamp() doesn't exist.
1.834 + // For now, if SetVolumeRamp() doesn't panic, we have to return EPass.
1.835 + // In future, maybe we can play the clip and get the volume at intervals?
1.836 + INFO_PRINTF1(_L("Warning : no API function to get volume ramp"));
1.837 +
1.838 + return EPass;
1.839 + }
1.840 +
1.841 +//------------------------------------------------------------------
1.842 +
1.843 +/**
1.844 + * Constructor
1.845 + */
1.846 +CTestMmfAclntToneRepeat::CTestMmfAclntToneRepeat(const TDesC& aTestName)
1.847 + :CTestMmfAclntTone(aTestName)
1.848 + {}
1.849 +
1.850 +CTestMmfAclntToneRepeat* CTestMmfAclntToneRepeat::NewL(const TDesC& aTestName)
1.851 + {
1.852 + CTestMmfAclntToneRepeat* self = new (ELeave) CTestMmfAclntToneRepeat(aTestName);
1.853 + return self;
1.854 + }
1.855 +
1.856 +/**
1.857 + * Set repeats
1.858 + */
1.859 +TVerdict CTestMmfAclntToneRepeat::DoTestL(CMdaAudioToneUtility* aToneUtil)
1.860 + {
1.861 + INFO_PRINTF1( _L("TestTone : Repeats"));
1.862 +
1.863 + iError = KErrTimedOut;
1.864 +
1.865 + TTimeIntervalMicroSeconds silence(0);
1.866 + aToneUtil->SetRepeats(NUMBER_OF_REPEATS,silence);
1.867 +
1.868 + TInt duration = I64INT(iDuration.Int64());
1.869 +
1.870 + iError = KErrTimedOut;
1.871 + INFO_PRINTF1( _L("Play CMdaAudioToneUtility"));
1.872 + aToneUtil->Play();
1.873 +
1.874 + TTime start;
1.875 + start.HomeTime();
1.876 + CActiveScheduler::Start();
1.877 + TTime stop;
1.878 + stop.HomeTime();
1.879 +
1.880 + TUint actualDuration = I64INT(stop.MicroSecondsFrom(start).Int64());
1.881 +
1.882 + INFO_PRINTF2(_L("Repeats : %d"), NUMBER_OF_REPEATS);
1.883 + INFO_PRINTF6(_L("Error : %d Start = %d Stop = %d Duration = %d ActualDuration = %d"),
1.884 + iError, I64INT(start.Int64()), I64INT(stop.Int64()), duration, actualDuration);
1.885 +
1.886 + if((iError == KErrNone) && (TimeComparison(actualDuration, duration * (NUMBER_OF_REPEATS + 1),
1.887 + KExpectedDeviation * NUMBER_OF_REPEATS)))
1.888 + return EPass;
1.889 +
1.890 + return EFail ;
1.891 + }
1.892 +
1.893 +//------------------------------------------------------------------
1.894 +
1.895 +/**
1.896 + * Constructor
1.897 + */
1.898 +CTestMmfAclntToneLength::CTestMmfAclntToneLength(const TDesC& aTestName)
1.899 + :CTestMmfAclntToneDtmf(aTestName,KShortDTMFString)
1.900 + {}
1.901 +
1.902 +CTestMmfAclntToneLength* CTestMmfAclntToneLength::NewL(const TDesC& aTestName)
1.903 + {
1.904 + CTestMmfAclntToneLength* self = new (ELeave) CTestMmfAclntToneLength(aTestName);
1.905 + return self;
1.906 + }
1.907 +
1.908 +/**
1.909 + * Configure tone on length, tone off length, pause length of DTMF Tones
1.910 + */
1.911 +TVerdict CTestMmfAclntToneLength::DoTestL(CMdaAudioToneUtility* aToneUtil)
1.912 + {
1.913 + INFO_PRINTF1( _L("TestTone : Length"));
1.914 +
1.915 + iError = KErrTimedOut;
1.916 + TTimeIntervalMicroSeconds32 on(KOneSecond), off(KOneSecond), pause(0);
1.917 +
1.918 + aToneUtil->SetDTMFLengths(on, off, pause);
1.919 +
1.920 + iError = KErrTimedOut;
1.921 + INFO_PRINTF1( _L("Play CMdaAudioToneUtility"));
1.922 + aToneUtil->Play();
1.923 +
1.924 + TTime start;
1.925 + start.HomeTime();
1.926 + CActiveScheduler::Start();
1.927 + TTime stop;
1.928 + stop.HomeTime();
1.929 +
1.930 + TUint actualDuration = I64INT(stop.MicroSecondsFrom(start).Int64());
1.931 +
1.932 + INFO_PRINTF6(_L("Error : %d Start = %d Stop = %d Duration = %d ActualDuration = %d"),
1.933 + iError, I64INT(start.Int64()), I64INT(stop.Int64()), KTwoSeconds, actualDuration);
1.934 +
1.935 + if((iError == KErrNone) && (TimeComparison(actualDuration, KTwoSeconds, KExpectedDeviation)))
1.936 + return EPass;
1.937 +
1.938 + return EFail ;
1.939 + }
1.940 +
1.941 +//------------------------------------------------------------------
1.942 +
1.943 +/**
1.944 + * Constructor
1.945 + */
1.946 +CTestMmfAclntPriorityTones::CTestMmfAclntPriorityTones()
1.947 + {
1.948 + // store the name of this test case
1.949 + // this is the name that is used by the script file
1.950 + // Each test step initialises it's own name
1.951 + iTestStepName = _L("MM-MMF-ACLNT-I-0165-HP");
1.952 + }
1.953 +
1.954 +void CTestMmfAclntPriorityTones::MchoComplete(TInt aID, TInt aError)
1.955 + {
1.956 + INFO_PRINTF1( _L("CTestMmfAclntPriorityTones : MMdaAudioToneObserver Callback for CMdaAudioToneUtility called"));
1.957 + iError = aError;
1.958 + INFO_PRINTF3( _L("iError %d ID %d"), iError, aID);
1.959 +
1.960 + if(iFirstCallback == -1)
1.961 + iFirstCallback = aID;
1.962 +
1.963 + if((--iCallbackCount) == 0)
1.964 + CActiveScheduler::Stop();
1.965 + }
1.966 +
1.967 +/**
1.968 + * Set priorities of tones
1.969 + */
1.970 +TVerdict CTestMmfAclntPriorityTones::DoTestStepL()
1.971 + {
1.972 + INFO_PRINTF1( _L("TestTone : Priorities"));
1.973 +
1.974 + iError = KErrTimedOut;
1.975 +
1.976 + CMdaAudioToneUtility* toneUtil[2];
1.977 + CToneCallbackHandler* callback[2];
1.978 +
1.979 + for(TInt i=0; i<2; i++)
1.980 + {
1.981 + callback[i] = new (ELeave) CToneCallbackHandler(i,this);
1.982 + CleanupStack::PushL(callback[i]);
1.983 + }
1.984 +
1.985 + toneUtil[0] = CMdaAudioToneUtility::NewL(*callback[0],NULL, -10, EMdaPriorityPreferenceTimeAndQuality);
1.986 + CleanupStack::PushL(toneUtil[0]);
1.987 + toneUtil[1] = CMdaAudioToneUtility::NewL(*callback[1],NULL, 0, EMdaPriorityPreferenceTimeAndQuality);
1.988 + CleanupStack::PushL(toneUtil[1]);
1.989 +
1.990 + toneUtil[0]->PrepareToPlayDTMFString(KDTMFString);
1.991 + toneUtil[1]->PrepareToPlayDTMFString(KDTMFString);
1.992 +
1.993 + // wait for initilisation callback
1.994 + iCallbackCount = 2;
1.995 + INFO_PRINTF1( _L("Initialise CMdaAudioToneUtility"));
1.996 + INFO_PRINTF1( _L("Initialise CMdaAudioToneUtility"));
1.997 + CActiveScheduler::Start();
1.998 +
1.999 + if(iError == KErrNone)
1.1000 + {
1.1001 + iError = KErrTimedOut;
1.1002 +
1.1003 + toneUtil[0]->Play();
1.1004 + toneUtil[1]->Play();
1.1005 +
1.1006 + INFO_PRINTF1( _L("Play CMdaAudioToneUtility"));
1.1007 + INFO_PRINTF1( _L("Play CMdaAudioToneUtility"));
1.1008 +
1.1009 + // wait for play to complete
1.1010 + iCallbackCount = 2;
1.1011 + iFirstCallback = -1;
1.1012 + CActiveScheduler::Start();
1.1013 +
1.1014 + if((iError == KErrNone) && (iFirstCallback == 0))
1.1015 + {
1.1016 + CleanupStack::PopAndDestroy(4);
1.1017 + return EPass;
1.1018 + }
1.1019 + }
1.1020 +
1.1021 + ERR_PRINTF2( _L("CMdaAudioToneUtility failed with error %d"),iError );
1.1022 +
1.1023 + CleanupStack::PopAndDestroy(4);
1.1024 + return EFail ;
1.1025 + }
1.1026 +
1.1027 +//------------------------------------------------------------------
1.1028 +
1.1029 +/**
1.1030 + * Constructor
1.1031 + */
1.1032 +CTestMmfAclntToneBalance::CTestMmfAclntToneBalance(const TDesC& aTestName,const TInt aBalance)
1.1033 + :CTestMmfAclntTone(aTestName) ,iBalance(aBalance)
1.1034 + {}
1.1035 +
1.1036 +CTestMmfAclntToneBalance* CTestMmfAclntToneBalance::NewL(const TDesC& aTestName,const TInt aBalance)
1.1037 + {
1.1038 + CTestMmfAclntToneBalance* self = new (ELeave) CTestMmfAclntToneBalance(aTestName,aBalance);
1.1039 + return self;
1.1040 + }
1.1041 +
1.1042 +/**
1.1043 + * Set balance and enquire balance
1.1044 + */
1.1045 +TVerdict CTestMmfAclntToneBalance::DoTestL(CMdaAudioToneUtility* aToneUtil)
1.1046 + {
1.1047 + INFO_PRINTF1( _L("TestTone : Balance"));
1.1048 +
1.1049 + if (iBalance < KMinBalance)
1.1050 + {
1.1051 + TRAPD(err, aToneUtil->SetBalanceL(iBalance));
1.1052 +
1.1053 + if (err != KErrNone)
1.1054 + {
1.1055 + INFO_PRINTF2(_L("SetBalanceL() returned unexpected error %d"), err);
1.1056 + return EFail;
1.1057 + }
1.1058 +
1.1059 + if(aToneUtil->GetBalanceL() == KMinBalance)
1.1060 + return EPass;
1.1061 + }
1.1062 + else if (iBalance > KMaxBalance)
1.1063 + {
1.1064 + TRAPD(err, aToneUtil->SetBalanceL(iBalance));
1.1065 +
1.1066 + if (err != KErrNone)
1.1067 + {
1.1068 + INFO_PRINTF2(_L("SetBalanceL() returned unexpected error %d"), err);
1.1069 + return EFail;
1.1070 + }
1.1071 +
1.1072 + if(aToneUtil->GetBalanceL() == KMaxBalance)
1.1073 + return EPass;
1.1074 + }
1.1075 + else
1.1076 + {
1.1077 + TRAPD(err, aToneUtil->SetBalanceL(iBalance));
1.1078 +
1.1079 + if (err != KErrNone)
1.1080 + {
1.1081 + INFO_PRINTF2(_L("SetBalanceL() returned unexpected error %d"), err);
1.1082 + return EFail;
1.1083 + }
1.1084 +
1.1085 + if(aToneUtil->GetBalanceL() == iBalance)
1.1086 + return EPass;
1.1087 + }
1.1088 +
1.1089 + return EFail;
1.1090 + }
1.1091 +
1.1092 +//------------------------------------------------------------------
1.1093 +
1.1094 +// NEGATIVE TESTING
1.1095 +
1.1096 +//------------------------------------------------------------------
1.1097 +
1.1098 +
1.1099 +
1.1100 +/**
1.1101 + * Constructor
1.1102 + */
1.1103 +CTestMmfAclntOnOffPause::CTestMmfAclntOnOffPause()
1.1104 + {
1.1105 + // store the name of this test case
1.1106 + // this is the name that is used by the script file
1.1107 +// Each test step initialises it's own name
1.1108 + iTestStepName = _L("MM-MMF-ACLNT-I-1155-HP");
1.1109 +
1.1110 +// this test does not inherit from CTestMmfAclntTone
1.1111 +// so we need to make the heap bigger here
1.1112 +// need a bigger heap size on EKA2 HW
1.1113 +#if !defined __WINS__
1.1114 + iHeapSize = KHeapSizeToneTestEKA2;
1.1115 +#endif // EKA2
1.1116 + }
1.1117 +
1.1118 +void CTestMmfAclntOnOffPause::MatoPrepareComplete(TInt aError)
1.1119 + {
1.1120 + iError = aError;
1.1121 + INFO_PRINTF1( _L("CTestMmfAclntOnOffPause::MatoPrepareComplete MMdaAudioToneObserver Callback for CMdaAudioToneUtility complete"));
1.1122 + INFO_PRINTF2( _L("iError %d"), iError);
1.1123 + CActiveScheduler::Stop();
1.1124 + }
1.1125 +
1.1126 +void CTestMmfAclntOnOffPause::MatoPlayComplete(TInt aError)
1.1127 + {
1.1128 + iError = aError;
1.1129 + INFO_PRINTF1( _L("CTestMmfAclntOnOffPause::MatoPlayComplete MMdaAudioToneObserver Callback for CMdaAudioToneUtility complete"));
1.1130 + INFO_PRINTF2( _L("iError %d"), iError);
1.1131 + CActiveScheduler::Stop();
1.1132 + }
1.1133 +
1.1134 +/**
1.1135 + * Set up tone on, off and pause length to illegal values.
1.1136 + */
1.1137 +TVerdict CTestMmfAclntOnOffPause::DoTestStepL( void )
1.1138 + {
1.1139 + INFO_PRINTF1( _L("TestTone : On/Off/Pause"));
1.1140 + TVerdict res = EFail;
1.1141 +
1.1142 + iError = KErrTimedOut;
1.1143 +
1.1144 + CMdaAudioToneUtility* toneUtil = CMdaAudioToneUtility::NewL(*this);
1.1145 + CleanupStack::PushL(toneUtil);
1.1146 + toneUtil->PrepareToPlayDTMFString(KDTMFString);
1.1147 + // Wait for prepare
1.1148 + INFO_PRINTF1( _L("Initialise CMdaAudioToneUtility"));
1.1149 + CActiveScheduler::Start();
1.1150 +
1.1151 + if(iError == KErrNone)
1.1152 + {
1.1153 + iError = KErrTimedOut;
1.1154 +
1.1155 + TTimeIntervalMicroSeconds32 on(-4), off(-3), pause(-5);
1.1156 +
1.1157 + toneUtil->SetDTMFLengths(on, off, pause);
1.1158 +
1.1159 + toneUtil->Play();
1.1160 + // wait for play to complete
1.1161 + INFO_PRINTF1( _L("Play CMdaAudioToneUtility"));
1.1162 + CActiveScheduler::Start();
1.1163 +
1.1164 + // check this worked
1.1165 + if(iError == KErrNone)
1.1166 + res = EPass;
1.1167 + }
1.1168 +
1.1169 + CleanupStack::Pop(); // toneUtil
1.1170 + ERR_PRINTF2( _L("CMdaAudioToneUtility completed with error %d"),iError );
1.1171 + delete toneUtil;
1.1172 + return res;
1.1173 + }
1.1174 +