os/mm/devsound/a3fcharacterisationtest/src/char_a3f_devsound_tonetest.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/mm/devsound/a3fcharacterisationtest/src/char_a3f_devsound_tonetest.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,8389 @@
     1.4 +// Copyright (c) 2008-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 +//
    1.18 +
    1.19 +#include "char_a3f_devsound_tonetest.h"
    1.20 +
    1.21 +
    1.22 +/*
    1.23 + *========================================================================================================
    1.24 + * MM-A3F-DEVSOUND-CHRTZ-TONE-0001
    1.25 + */
    1.26 +RA3FDevSoundToneSetConfigTest::RA3FDevSoundToneSetConfigTest(const TDesC& aTestName)
    1.27 +	:	RA3FDevSoundTestBase(aTestName), iSampleRate(0),
    1.28 +		iChannels(0)
    1.29 +	{
    1.30 +	}
    1.31 +
    1.32 +RA3FDevSoundToneSetConfigTest* RA3FDevSoundToneSetConfigTest::NewL(const TDesC& aTestName)
    1.33 +	{
    1.34 +	RA3FDevSoundToneSetConfigTest * self = new(ELeave)RA3FDevSoundToneSetConfigTest(aTestName);
    1.35 +	return self;
    1.36 +	}
    1.37 +
    1.38 +void RA3FDevSoundToneSetConfigTest::DoKickoffTestL()
    1.39 +	{
    1.40 +	if (!GetIntFromConfig(iTestStepName, KSampleRate, iSampleRate))
    1.41 +		{
    1.42 +		ERR_PRINTF2(KMsgErrorGetParameter, &KSampleRate);
    1.43 +		StopTest(KErrNotFound);
    1.44 +		return;
    1.45 +		}
    1.46 +	if (!GetIntFromConfig(iTestStepName, KChannel, iChannels))
    1.47 +		{
    1.48 +		ERR_PRINTF2(KMsgErrorGetParameter, &KChannel);
    1.49 +		StopTest(KErrNotFound);
    1.50 +		return;
    1.51 +		}
    1.52 +	}
    1.53 +
    1.54 +
    1.55 +void RA3FDevSoundToneSetConfigTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError)
    1.56 +	{
    1.57 +	switch(iDevSoundState)
    1.58 +		{
    1.59 +		case EStateCreated:
    1.60 +			{
    1.61 +			if(aDevSoundEvent == EEventInitialize)
    1.62 +				{
    1.63 +				__ASSERT_ALWAYS((aError == KErrNone), Panic(_L("RA3FDevSoundToneSetConfigTest"), EFsmIncorrectErrorPassed));
    1.64 +				INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL"));
    1.65 +				TRAPD(err, iMMFDevSound->InitializeL(*this, EMMFStateTonePlaying));
    1.66 +				if (err != KErrNone)
    1.67 +					{
    1.68 +					ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err);
    1.69 +					StopTest(err);
    1.70 +					break;
    1.71 +					}
    1.72 +				INFO_PRINTF1(_L("DevSound State: EStateInitializing"));
    1.73 +				iDevSoundState = EStateInitializing;
    1.74 +				}
    1.75 +			else
    1.76 +				{
    1.77 +				ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent);
    1.78 +				StopTest(aError, EFail);
    1.79 +				}
    1.80 +			break;
    1.81 +			}
    1.82 +		case EStateInitializing:
    1.83 +			{
    1.84 +			if (aDevSoundEvent == EEventInitComplete && aError == KErrNone)
    1.85 +				{
    1.86 +				TMMFCapabilities capabilitiesSet;
    1.87 +				TBuf<KMaxSampleRateStringLength> stringSampleRateSet;
    1.88 +				TBuf<KMaxChannelsStringLength> stringChannelsSet;
    1.89 +				TMMFSampleRate eSampleRate;
    1.90 +				SampleRateFromTIntToTMMFSampleRate (iSampleRate, eSampleRate);
    1.91 +				capabilitiesSet.iRate = eSampleRate;
    1.92 +				capabilitiesSet.iChannels = iChannels;
    1.93 +				SampleRateFromTUintToString (capabilitiesSet.iRate,	stringSampleRateSet);
    1.94 +				ChannelsFromTUintToString (capabilitiesSet.iChannels, stringChannelsSet);
    1.95 +				INFO_PRINTF3(_L("Calling CMMFDevSound::SetConfigL using sample rate = %S and channel mode =%S"), &stringSampleRateSet, &stringChannelsSet);
    1.96 +				TRAPD(err, iMMFDevSound->SetConfigL(capabilitiesSet));
    1.97 +				if (err != KErrNone)
    1.98 +					{
    1.99 +					ERR_PRINTF2(_L("CMMFDevSound::SetConfigL left with error = %d"), err);
   1.100 +					StopTest(err);
   1.101 +					break;
   1.102 +					}
   1.103 +				TMMFCapabilities capabilitiesGet;
   1.104 +				TBuf<KMaxSampleRateStringLength> stringSampleRateGet;
   1.105 +				TBuf<KMaxChannelsStringLength> stringChannelsGet;
   1.106 +				capabilitiesGet=iMMFDevSound->Config();
   1.107 +				SampleRateFromTUintToString (capabilitiesGet.iRate, stringSampleRateGet);
   1.108 +				ChannelsFromTUintToString (capabilitiesGet.iChannels, stringChannelsGet);
   1.109 +				if (capabilitiesGet.iRate != capabilitiesSet.iRate && capabilitiesGet.iChannels != capabilitiesSet.iChannels)
   1.110 +					{
   1.111 +					ERR_PRINTF3(_L("Retrieved sample rate and channel %S %S"), &stringSampleRateGet, &stringChannelsGet);
   1.112 +					ERR_PRINTF3(_L("Expected %S %S"), &stringSampleRateSet, &stringChannelsSet);
   1.113 +					StopTest(aError, EFail);
   1.114 +					break;
   1.115 +					}
   1.116 +				INFO_PRINTF1(_L("========== Test Case Successfully Completed =========="));
   1.117 +				StopTest();
   1.118 +				}
   1.119 +			else if (aDevSoundEvent == EEventInitComplete && aError != KErrNone)
   1.120 +				{
   1.121 +				ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error = %d"), aError);
   1.122 +				StopTest(aError);
   1.123 +				}
   1.124 +			else
   1.125 +				{
   1.126 +				ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent);
   1.127 +				StopTest(aError, EFail);
   1.128 +				}
   1.129 +			break;
   1.130 +			}
   1.131 +		default:
   1.132 +			{
   1.133 +			ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState);
   1.134 +			StopTest(aError, EFail);
   1.135 +			}
   1.136 +		}
   1.137 +	}
   1.138 +
   1.139 +/*
   1.140 + *========================================================================================================
   1.141 + * MM-A3F-DEVSOUND-CHRTZ-TONE-0002
   1.142 + */
   1.143 +RA3FDevSoundToneSetPrioritySettingsTest::RA3FDevSoundToneSetPrioritySettingsTest(const TDesC& aTestName)
   1.144 +	:	RA3FDevSoundTestBase(aTestName), iPriority(0)
   1.145 +	{
   1.146 +	}
   1.147 +
   1.148 +RA3FDevSoundToneSetPrioritySettingsTest* RA3FDevSoundToneSetPrioritySettingsTest::NewL(const TDesC& aTestName)
   1.149 +	{
   1.150 +	RA3FDevSoundToneSetPrioritySettingsTest * self = new(ELeave)RA3FDevSoundToneSetPrioritySettingsTest(aTestName);
   1.151 +	return self;
   1.152 +	}
   1.153 +
   1.154 +void RA3FDevSoundToneSetPrioritySettingsTest::DoKickoffTestL()
   1.155 +	{
   1.156 +	if (!GetIntFromConfig(iTestStepName, KPriority, iPriority))
   1.157 +		{
   1.158 +		ERR_PRINTF2(KMsgErrorGetParameter, &KPriority);
   1.159 +		StopTest(KErrUnknown);
   1.160 +		}
   1.161 +	}
   1.162 +
   1.163 +void RA3FDevSoundToneSetPrioritySettingsTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError)
   1.164 +	{
   1.165 +	switch (iDevSoundState)
   1.166 +		{
   1.167 +		case EStateCreated:
   1.168 +			{
   1.169 +			if (aDevSoundEvent == EEventInitialize)
   1.170 +				{
   1.171 +				__ASSERT_ALWAYS((aError == KErrNone), Panic(_L("RA3FDevSoundToneSetPrioritySettingsTest"), EFsmIncorrectErrorPassed));
   1.172 +				INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL"));
   1.173 +				TRAPD(err, iMMFDevSound->InitializeL(*this, EMMFStateTonePlaying));
   1.174 +				if (err != KErrNone)
   1.175 +					{
   1.176 +					ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err);
   1.177 +					StopTest(err);
   1.178 +					break;
   1.179 +					}
   1.180 +				INFO_PRINTF1(_L("DevSound State: EStateInitializing"));
   1.181 +				iDevSoundState = EStateInitializing;
   1.182 +				}
   1.183 +			else
   1.184 +				{
   1.185 +				ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent);
   1.186 +				StopTest(aError, EFail);
   1.187 +				}
   1.188 +			break;
   1.189 +			}
   1.190 +		case EStateInitializing:
   1.191 +			{
   1.192 +			if (aDevSoundEvent == EEventInitComplete && aError == KErrNone)
   1.193 +				{
   1.194 +				TMMFPrioritySettings priority;
   1.195 +				priority.iPriority = iPriority;
   1.196 +				INFO_PRINTF2(_L("Calling CMMFDevSound::SetPrioritySettings using a priority value = %d"), iPriority);
   1.197 +				iMMFDevSound->SetPrioritySettings (priority);
   1.198 +				INFO_PRINTF1(_L("========== Test Case Successfully Completed =========="));
   1.199 +				StopTest();
   1.200 +				}
   1.201 +			else if (aDevSoundEvent == EEventInitComplete && aError != KErrNone)
   1.202 +				{
   1.203 +				ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error = %d"), aError);
   1.204 +				StopTest(aError);
   1.205 +				}
   1.206 +			else
   1.207 +				{
   1.208 +				ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent);
   1.209 +				StopTest(aError, EFail);
   1.210 +				}
   1.211 +			break;
   1.212 +			}
   1.213 +		default:
   1.214 +			{
   1.215 +			ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState);
   1.216 +			StopTest(aError, EFail);
   1.217 +			}
   1.218 +		}
   1.219 +	}
   1.220 +
   1.221 +/*
   1.222 + *========================================================================================================
   1.223 + * MM-A3F-DEVSOUND-CHRTZ-TONE-0003
   1.224 + */
   1.225 +RA3FDevSoundToneSetVolumeTest::RA3FDevSoundToneSetVolumeTest(const TDesC& aTestName)
   1.226 +	:	RA3FDevSoundTestBase(aTestName), iVolume(0)
   1.227 +	{
   1.228 +	}
   1.229 +
   1.230 +RA3FDevSoundToneSetVolumeTest* RA3FDevSoundToneSetVolumeTest::NewL(const TDesC& aTestName)
   1.231 +	{
   1.232 +	RA3FDevSoundToneSetVolumeTest * self = new(ELeave)RA3FDevSoundToneSetVolumeTest(aTestName);
   1.233 +	return self;
   1.234 +	}
   1.235 +
   1.236 +void RA3FDevSoundToneSetVolumeTest::DoKickoffTestL()
   1.237 +	{
   1.238 +	if (!GetIntFromConfig(iTestStepName, KVolume, iVolume))
   1.239 +		{
   1.240 +		ERR_PRINTF2(KMsgErrorGetParameter, &KVolume);
   1.241 +		StopTest(KErrUnknown);
   1.242 +		return;
   1.243 +		}
   1.244 +	}
   1.245 +
   1.246 +void RA3FDevSoundToneSetVolumeTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError)
   1.247 +	{
   1.248 +	switch (iDevSoundState)
   1.249 +		{
   1.250 +		case EStateCreated:
   1.251 +			{
   1.252 +			if (aDevSoundEvent == EEventInitialize)
   1.253 +				{
   1.254 +				__ASSERT_ALWAYS((aError == KErrNone), Panic(_L("RA3FDevSoundToneSetVolumeTest"), EFsmIncorrectErrorPassed));
   1.255 +				INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL"));
   1.256 +				TRAPD(err, iMMFDevSound->InitializeL(*this, EMMFStateTonePlaying));
   1.257 +				if (err != KErrNone)
   1.258 +					{
   1.259 +					ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err);
   1.260 +					StopTest(err);
   1.261 +					break;
   1.262 +					}
   1.263 +				INFO_PRINTF1(_L("DevSound State: EStateInitializing"));
   1.264 +				iDevSoundState = EStateInitializing;
   1.265 +				}
   1.266 +			else
   1.267 +				{
   1.268 +				ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent);
   1.269 +				StopTest(aError, EFail);
   1.270 +				}
   1.271 +			break;
   1.272 +			}
   1.273 +		case EStateInitializing:
   1.274 +			{
   1.275 +			if (aDevSoundEvent == EEventInitComplete && aError == KErrNone)
   1.276 +				{
   1.277 +				INFO_PRINTF2(_L("Calling CMMFDevSound::SetVolume with volume value = %d"), iVolume);
   1.278 +				iMMFDevSound->SetVolume(iVolume);
   1.279 +				TInt volumeGet;
   1.280 +				volumeGet=iMMFDevSound->Volume();
   1.281 +				if (volumeGet == iVolume)
   1.282 +					{
   1.283 +					INFO_PRINTF2(_L("CMMFDevSound::SetVolume succeeded with value = %d"), volumeGet);
   1.284 +					StopTest();
   1.285 +					}
   1.286 +				else
   1.287 +					{
   1.288 +					ERR_PRINTF2(_L("CMMFDevSound::SetVolume failed with value = %d"), volumeGet);
   1.289 +					ERR_PRINTF2(_L("Expected value = %d"), iVolume);
   1.290 +					StopTest(aError, EFail);
   1.291 +					}
   1.292 +				}
   1.293 +			else if (aDevSoundEvent == EEventInitComplete && aError != KErrNone)
   1.294 +				{
   1.295 +				ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error = %d"), aError);
   1.296 +				StopTest(aError);
   1.297 +				}
   1.298 +			else
   1.299 +				{
   1.300 +				ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent);
   1.301 +				StopTest(aError, EFail);
   1.302 +				}
   1.303 +			break;
   1.304 +			}
   1.305 +		default:
   1.306 +			{
   1.307 +			ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState);
   1.308 +			StopTest(aError, EFail);
   1.309 +			}
   1.310 +		}
   1.311 +	}
   1.312 +
   1.313 +/*
   1.314 + *========================================================================================================
   1.315 + * MM-A3F-DEVSOUND-CHRTZ-TONE-0004
   1.316 + */
   1.317 +RA3FDevSoundToneVolumeRampTest::RA3FDevSoundToneVolumeRampTest(const TDesC& aTestName)
   1.318 +	:	RA3FDevSoundTestBase(aTestName), iVolumeRamp(0),
   1.319 +		iDuration(0), iFrequencyTone1(0)
   1.320 +	{
   1.321 +	}
   1.322 +
   1.323 +RA3FDevSoundToneVolumeRampTest* RA3FDevSoundToneVolumeRampTest::NewL(const TDesC& aTestName)
   1.324 +	{
   1.325 +	RA3FDevSoundToneVolumeRampTest * self = new(ELeave)RA3FDevSoundToneVolumeRampTest(aTestName);
   1.326 +	return self;
   1.327 +	}
   1.328 +
   1.329 +void RA3FDevSoundToneVolumeRampTest::DoKickoffTestL()
   1.330 +	{
   1.331 +	if (!GetIntFromConfig(iTestStepName, KVolumeRamp, iVolumeRamp))
   1.332 +		{
   1.333 +		ERR_PRINTF2(KMsgErrorGetParameter, &KVolumeRamp);
   1.334 +		StopTest(KErrNotFound);
   1.335 +		return;
   1.336 +		}
   1.337 +	if (!GetIntFromConfig(iTestStepName, KDuration, iDuration))
   1.338 +			{
   1.339 +			ERR_PRINTF2(KMsgErrorGetParameter, &KDuration);
   1.340 +			StopTest(KErrNotFound);
   1.341 +			return;
   1.342 +			}
   1.343 +	if (!GetIntFromConfig(iTestStepName, KFrequencyTone1, iFrequencyTone1))
   1.344 +		{
   1.345 +		ERR_PRINTF2(KMsgErrorGetParameter, &KFrequencyTone1);
   1.346 +		StopTest(KErrNotFound);
   1.347 +		return;
   1.348 +		}
   1.349 +	}
   1.350 +
   1.351 +void RA3FDevSoundToneVolumeRampTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError)
   1.352 +	{
   1.353 +	switch (iDevSoundState)
   1.354 +		{
   1.355 +		case EStateCreated:
   1.356 +			{
   1.357 +			if (aDevSoundEvent == EEventInitialize)
   1.358 +				{
   1.359 +				__ASSERT_ALWAYS((aError == KErrNone), Panic(_L("RA3FDevSoundToneVolumeRampTest"), EFsmIncorrectErrorPassed));
   1.360 +				INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL"));
   1.361 +				TRAPD(err, iMMFDevSound->InitializeL(*this, EMMFStateTonePlaying));
   1.362 +				if (err != KErrNone)
   1.363 +					{
   1.364 +					ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err);
   1.365 +					StopTest(err);
   1.366 +					break;
   1.367 +					}
   1.368 +				INFO_PRINTF1(_L("DevSound State: EStateInitializing"));
   1.369 +				iDevSoundState = EStateInitializing;
   1.370 +				}
   1.371 +			else
   1.372 +				{
   1.373 +				ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent);
   1.374 +				StopTest(aError, EFail);
   1.375 +				}
   1.376 +			break;
   1.377 +			}
   1.378 +		case EStateInitializing:
   1.379 +			{
   1.380 +			if (aDevSoundEvent == EEventInitComplete && aError == KErrNone)
   1.381 +				{
   1.382 +				INFO_PRINTF2(_L("Calling CMMFDevSound::SetVolumeRamp using volume ramp time = %d"), iVolumeRamp);
   1.383 +				iMMFDevSound->SetVolumeRamp(iVolumeRamp);
   1.384 +				iStartTime.HomeTime();
   1.385 +				INFO_PRINTF3(_L("Calling CMMFDevSound::PlayToneL %d Hz during %d secs "), iFrequencyTone1, iDuration);
   1.386 +				TRAPD(err, iMMFDevSound->PlayToneL(iFrequencyTone1, iDuration*KMicroSecsInOneSec));
   1.387 +				if (err != KErrNone)
   1.388 +					{
   1.389 +					ERR_PRINTF2(_L("CMMFDevSound::PlayToneL left with error : %d!"), err);
   1.390 +					StopTest(err);
   1.391 +					break;
   1.392 +					}
   1.393 +				}
   1.394 +			else if (aDevSoundEvent == EEventInitComplete && aError != KErrNone)
   1.395 +				{
   1.396 +				ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error = %d"), aError);
   1.397 +				StopTest(aError);
   1.398 +				}
   1.399 +			else
   1.400 +				{
   1.401 +				ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent);
   1.402 +				StopTest(aError, EFail);
   1.403 +				}
   1.404 +			break;
   1.405 +			}
   1.406 +		default:
   1.407 +			{
   1.408 +			ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState);
   1.409 +			StopTest(aError, EFail);
   1.410 +			}
   1.411 +		}
   1.412 +	}
   1.413 +
   1.414 +void RA3FDevSoundToneVolumeRampTest::ToneFinished(TInt aError)
   1.415 +	{
   1.416 +	INFO_PRINTF1(_L("========== DevSound ToneFinished() callback =========="));
   1.417 +	if (aError == KErrUnderflow)
   1.418 +		{
   1.419 +		iEndTime.HomeTime();
   1.420 +		iPlayToneTime = iEndTime.MicroSecondsFrom(iStartTime);
   1.421 +		TInt totalExpectedReproductionTime = iDuration * KMicroSecsInOneSec;
   1.422 +		if(iPlayToneTime < totalExpectedReproductionTime + KPlayVarianceTime && iPlayToneTime > totalExpectedReproductionTime - KPlayVarianceTime)
   1.423 +			{
   1.424 +			INFO_PRINTF2(_L("Play time is %Ld microseconds"), iPlayToneTime.Int64());
   1.425 +			StopTest();
   1.426 +			}
   1.427 +		else
   1.428 +			{
   1.429 +			ERR_PRINTF3(_L("Play time is %Ld microseconds and it should have been %d microseconds"), iPlayToneTime.Int64(), totalExpectedReproductionTime);
   1.430 +			StopTest(KErrNone, EFail);
   1.431 +			}
   1.432 +		}
   1.433 +	else
   1.434 +		{
   1.435 +		ERR_PRINTF2(_L("DevSound called ToneFinished with error = %d"), aError);
   1.436 +		ERR_PRINTF2(_L("Expected error = %d"), KErrUnderflow);
   1.437 +		StopTest(aError, EFail);
   1.438 +		}
   1.439 +	}
   1.440 +
   1.441 +/*
   1.442 + *========================================================================================================
   1.443 + * MM-A3F-DEVSOUND-CHRTZ-TONE-0005
   1.444 + */
   1.445 +RA3FDevSoundToneSetToneRepeatsTest::RA3FDevSoundToneSetToneRepeatsTest(const TDesC& aTestName)
   1.446 +	:	RA3FDevSoundTestBase(aTestName),
   1.447 +		iDuration(0),
   1.448 +		iFrequencyTone1(0),
   1.449 +		iRepeatTrailingSilence(0),
   1.450 +		iRepeatCount(0)
   1.451 +	{
   1.452 +	}
   1.453 +
   1.454 +RA3FDevSoundToneSetToneRepeatsTest* RA3FDevSoundToneSetToneRepeatsTest::NewL(const TDesC& aTestName)
   1.455 +	{
   1.456 +	RA3FDevSoundToneSetToneRepeatsTest * self = new(ELeave)RA3FDevSoundToneSetToneRepeatsTest(aTestName);
   1.457 +	return self;
   1.458 +	}
   1.459 +
   1.460 +void RA3FDevSoundToneSetToneRepeatsTest::DoKickoffTestL()
   1.461 +	{
   1.462 +	if (!GetIntFromConfig(iTestStepName, KRepeatCount, iRepeatCount))
   1.463 +		{
   1.464 +		ERR_PRINTF2(KMsgErrorGetParameter, &KRepeatCount);
   1.465 +		StopTest(KErrNotFound);
   1.466 +		return;
   1.467 +		}
   1.468 +	if (!GetIntFromConfig(iTestStepName, KRepeatTrailingSilence, iRepeatTrailingSilence))
   1.469 +		{
   1.470 +		ERR_PRINTF2(KMsgErrorGetParameter, &KRepeatTrailingSilence);
   1.471 +		StopTest(KErrNotFound);
   1.472 +		return;
   1.473 +		}
   1.474 +	if (!GetIntFromConfig(iTestStepName, KDuration, iDuration))
   1.475 +		{
   1.476 +		ERR_PRINTF2(KMsgErrorGetParameter, &KDuration);
   1.477 +		StopTest(KErrNotFound);
   1.478 +		return;
   1.479 +		}
   1.480 +	if (!GetIntFromConfig(iTestStepName, KFrequencyTone1, iFrequencyTone1))
   1.481 +		{
   1.482 +		ERR_PRINTF2(KMsgErrorGetParameter, &KFrequencyTone1);
   1.483 +		StopTest(KErrNotFound);
   1.484 +		return;
   1.485 +		}
   1.486 +	}
   1.487 +
   1.488 +void RA3FDevSoundToneSetToneRepeatsTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError)
   1.489 +	{
   1.490 +	switch (iDevSoundState)
   1.491 +		{
   1.492 +		case EStateCreated:
   1.493 +			{
   1.494 +			if (aDevSoundEvent == EEventInitialize)
   1.495 +				{
   1.496 +				__ASSERT_ALWAYS((aError == KErrNone), Panic(_L("RA3FDevSoundToneSetToneRepeatsTest"), EFsmIncorrectErrorPassed));
   1.497 +				INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL"));
   1.498 +				TRAPD(err, iMMFDevSound->InitializeL(*this, EMMFStateTonePlaying));
   1.499 +				if (err != KErrNone)
   1.500 +					{
   1.501 +					ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err);
   1.502 +					StopTest(err);
   1.503 +					break;
   1.504 +					}
   1.505 +				INFO_PRINTF1(_L("DevSound State: EStateInitializing"));
   1.506 +				iDevSoundState = EStateInitializing;
   1.507 +				}
   1.508 +			else
   1.509 +				{
   1.510 +				ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent);
   1.511 +				StopTest(aError, EFail);
   1.512 +				}
   1.513 +			break;
   1.514 +			}
   1.515 +		case EStateInitializing:
   1.516 +			{
   1.517 +			if (aDevSoundEvent == EEventInitComplete && aError == KErrNone)
   1.518 +				{
   1.519 +				iMMFDevSound->SetVolume(iMMFDevSound->MaxVolume());
   1.520 +				iStartTime.HomeTime();
   1.521 +				INFO_PRINTF3(_L("Calling CMMFDevSound::SetToneRepeats using repeatCount = %d and trailingSilence = %d"), iRepeatCount, iRepeatTrailingSilence);
   1.522 +				iMMFDevSound->SetToneRepeats(iRepeatCount, iRepeatTrailingSilence);
   1.523 +				INFO_PRINTF3(_L("Calling CMMFDevSound::PlayToneL %d Hz during %d secs "), iFrequencyTone1, iDuration);
   1.524 +				TRAPD(err, iMMFDevSound->PlayToneL(iFrequencyTone1, iDuration*KMicroSecsInOneSec));
   1.525 +				if (err != KErrNone)
   1.526 +					{
   1.527 +					ERR_PRINTF2(_L("CMMFDevSound::PlayToneL left with error : %d!"), err);
   1.528 +					StopTest(err);
   1.529 +					break;
   1.530 +					}
   1.531 +				}
   1.532 +			else if (aDevSoundEvent == EEventInitComplete && aError != KErrNone)
   1.533 +				{
   1.534 +				ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error = %d"), aError);
   1.535 +				StopTest(aError);
   1.536 +				}
   1.537 +			else
   1.538 +				{
   1.539 +				ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent);
   1.540 +				StopTest(aError, EFail);
   1.541 +				}
   1.542 +			break;
   1.543 +			}
   1.544 +		default:
   1.545 +			{
   1.546 +			ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState);
   1.547 +			StopTest(aError, EFail);
   1.548 +			}
   1.549 +		}
   1.550 +	}
   1.551 +
   1.552 +void RA3FDevSoundToneSetToneRepeatsTest::ToneFinished(TInt aError)
   1.553 +	{
   1.554 +	INFO_PRINTF1(_L("========== DevSound ToneFinished() callback =========="));
   1.555 +	if (aError == KErrUnderflow)
   1.556 +		{
   1.557 +		iEndTime.HomeTime();
   1.558 +		iPlayToneTime = iEndTime.MicroSecondsFrom(iStartTime);
   1.559 +		TInt repeatTrailingSilenceToSecs = iRepeatTrailingSilence/KMicroSecsInOneSec;
   1.560 +		TInt totalExpectedReproductionTime = (iRepeatCount * iDuration + iDuration + (repeatTrailingSilenceToSecs*iRepeatCount))*KMicroSecsInOneSec;
   1.561 +		if(iPlayToneTime < totalExpectedReproductionTime + KPlayVarianceTime && iPlayToneTime > totalExpectedReproductionTime - KPlayVarianceTime)
   1.562 +			{
   1.563 +			INFO_PRINTF1(_L("Play tone repeats succeded."));
   1.564 +			INFO_PRINTF2(_L("Play time is %Ld microseconds"), iPlayToneTime.Int64());
   1.565 +			StopTest();
   1.566 +			}
   1.567 +		else
   1.568 +			{
   1.569 +			ERR_PRINTF1(_L("Play tone repeats did not work as planned."));
   1.570 +			ERR_PRINTF3(_L("Play time is %Ld microseconds and it should have been %d microseconds"), iPlayToneTime.Int64(), totalExpectedReproductionTime);
   1.571 +			StopTest(KErrNone, EFail);
   1.572 +			}
   1.573 +		}
   1.574 +	else
   1.575 +		{
   1.576 +		ERR_PRINTF2(_L("DevSound called ToneFinished with error = %d"), aError);
   1.577 +		ERR_PRINTF2(_L("Expected error = %d"), KErrUnderflow);
   1.578 +		StopTest(aError, EFail);
   1.579 +		}
   1.580 +	}
   1.581 +
   1.582 +/*
   1.583 + *========================================================================================================
   1.584 + * MM-A3F-DEVSOUND-CHRTZ-TONE-0006
   1.585 + */
   1.586 +RA3FDevSoundToneSetDTMFLengthsTest::RA3FDevSoundToneSetDTMFLengthsTest(const TDesC& aTestName)
   1.587 +	:	RA3FDevSoundTestBase(aTestName), iToneOnLength(0),
   1.588 +		iToneOffLength(0), iPauseLength(0), iDTMFPauses(0),
   1.589 +		iDTMFTones(0)
   1.590 +	{
   1.591 +	}
   1.592 +
   1.593 +RA3FDevSoundToneSetDTMFLengthsTest* RA3FDevSoundToneSetDTMFLengthsTest::NewL(const TDesC& aTestName)
   1.594 +	{
   1.595 +	RA3FDevSoundToneSetDTMFLengthsTest * self = new(ELeave)RA3FDevSoundToneSetDTMFLengthsTest(aTestName);
   1.596 +	return self;
   1.597 +	}
   1.598 +
   1.599 +void RA3FDevSoundToneSetDTMFLengthsTest::DoKickoffTestL()
   1.600 +	{
   1.601 +	if (!GetIntFromConfig(iTestStepName, KToneOnLength, iToneOnLength))
   1.602 +		{
   1.603 +		ERR_PRINTF2(KMsgErrorGetParameter, &KToneOnLength);
   1.604 +		StopTest(KErrNotFound);
   1.605 +		return;
   1.606 +		}
   1.607 +	if (!GetIntFromConfig(iTestStepName, KToneOffLength, iToneOffLength))
   1.608 +		{
   1.609 +		ERR_PRINTF2(KMsgErrorGetParameter, &KToneOffLength);
   1.610 +		StopTest(KErrNotFound);
   1.611 +		return;
   1.612 +		}
   1.613 +	if (!GetIntFromConfig(iTestStepName, KPauseLength, iPauseLength))
   1.614 +		{
   1.615 +		ERR_PRINTF2(KMsgErrorGetParameter, &KPauseLength);
   1.616 +		StopTest(KErrNotFound);
   1.617 +		return;
   1.618 +		}
   1.619 +	TPtrC DTMF;
   1.620 +	if (!GetStringFromConfig(iTestStepName, KDTMFString, DTMF))
   1.621 +		{
   1.622 +		ERR_PRINTF2(KMsgErrorGetParameter, &KDTMFString);
   1.623 +		StopTest(KErrNotFound);
   1.624 +		return;
   1.625 +		}
   1.626 +	iDTMFString.Copy(DTMF);
   1.627 +	for(TInt i =0 ; i< iDTMFString.Length() ; i++)
   1.628 +		{
   1.629 +		if (iDTMFString[i] == ',')
   1.630 +			{
   1.631 +			iDTMFPauses++;
   1.632 +			}
   1.633 +		else
   1.634 +			{
   1.635 +			iDTMFTones++;
   1.636 +			}
   1.637 +		}
   1.638 +	}
   1.639 +
   1.640 +void RA3FDevSoundToneSetDTMFLengthsTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError)
   1.641 +	{
   1.642 +	switch (iDevSoundState)
   1.643 +		{
   1.644 +		case EStateCreated:
   1.645 +			{
   1.646 +			if (aDevSoundEvent == EEventInitialize)
   1.647 +				{
   1.648 +				__ASSERT_ALWAYS((aError == KErrNone), Panic(_L("RA3FDevSoundToneSetDTMFLengthsTest"), EFsmIncorrectErrorPassed));
   1.649 +				INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL"));
   1.650 +				TRAPD(err, iMMFDevSound->InitializeL(*this, EMMFStateTonePlaying));
   1.651 +				if (err != KErrNone)
   1.652 +					{
   1.653 +					ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err);
   1.654 +					StopTest(err);
   1.655 +					break;
   1.656 +					}
   1.657 +				INFO_PRINTF1(_L("DevSound State: EStateInitializing"));
   1.658 +				iDevSoundState = EStateInitializing;
   1.659 +				}
   1.660 +			else
   1.661 +				{
   1.662 +				ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent);
   1.663 +				StopTest(aError, EFail);
   1.664 +				}
   1.665 +			break;
   1.666 +			}
   1.667 +		case EStateInitializing:
   1.668 +			{
   1.669 +			if (aDevSoundEvent == EEventInitComplete && aError == KErrNone)
   1.670 +				{
   1.671 +				iMMFDevSound->SetVolume(iMMFDevSound->MaxVolume());
   1.672 +				TTimeIntervalMicroSeconds32 ToneOnLength(iToneOnLength);
   1.673 +				TTimeIntervalMicroSeconds32 ToneOffLength(iToneOffLength);
   1.674 +				TTimeIntervalMicroSeconds32 PauseLength(iPauseLength);
   1.675 +				INFO_PRINTF4(_L("Calling CMMFDevSound::SetDTMFLengths. ToneOnLength = %d, ToneOffLength = %d and PauseLength = %d"), ToneOnLength.Int(), ToneOffLength.Int(), PauseLength.Int());
   1.676 +				iMMFDevSound->SetDTMFLengths(ToneOnLength, ToneOffLength, PauseLength);
   1.677 +				iStartTime.HomeTime();
   1.678 +				INFO_PRINTF2(_L("Calling CMMFDevSound::PlayDTMFStringL %S"), &iDTMFString);
   1.679 +				TRAPD(err, iMMFDevSound->PlayDTMFStringL(iDTMFString));
   1.680 +				if (err != KErrNone)
   1.681 +					{
   1.682 +					ERR_PRINTF2(_L("CMMFDevSound::PlayDTMFStringL left with error : %d!"), err);
   1.683 +					StopTest(err);
   1.684 +					break;
   1.685 +					}
   1.686 +				}
   1.687 +			else if (aDevSoundEvent == EEventInitComplete && aError != KErrNone)
   1.688 +				{
   1.689 +				ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error = %d"), aError);
   1.690 +				StopTest(aError);
   1.691 +				}
   1.692 +			else
   1.693 +				{
   1.694 +				ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent);
   1.695 +				StopTest(aError, EFail);
   1.696 +				}
   1.697 +			break;
   1.698 +			}
   1.699 +		default:
   1.700 +			{
   1.701 +			ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState);
   1.702 +			StopTest(aError, EFail);
   1.703 +			}
   1.704 +		}
   1.705 +	}
   1.706 +
   1.707 +void RA3FDevSoundToneSetDTMFLengthsTest::ToneFinished(TInt aError)
   1.708 +	{
   1.709 +	INFO_PRINTF1(_L("========== DevSound ToneFinished() callback =========="));
   1.710 +	if (aError == KErrUnderflow)
   1.711 +		{
   1.712 +		iEndTime.HomeTime();
   1.713 +		iPlayToneTime = iEndTime.MicroSecondsFrom(iStartTime);
   1.714 +		TInt totalExpectedReproductionTime = iToneOnLength*iDTMFTones + iToneOffLength * iDTMFTones + iDTMFPauses * iPauseLength;
   1.715 +		if (iPlayToneTime.Int64() < totalExpectedReproductionTime + KPlayVarianceTime && iPlayToneTime.Int64() > totalExpectedReproductionTime - KPlayVarianceTime)
   1.716 +			{
   1.717 +			INFO_PRINTF1(_L("Calling CMMFDevSound::SetDTMFLengths succeded."));
   1.718 +			INFO_PRINTF2(_L("Play time is %Ld microseconds"), iPlayToneTime.Int64());
   1.719 +			StopTest();
   1.720 +			}
   1.721 +		else
   1.722 +			{
   1.723 +			ERR_PRINTF2(_L("Calling CMMFDevSound::SetDTMFLengths failed with %Ld"), iPlayToneTime.Int64());
   1.724 +			ERR_PRINTF2(_L("Expected time %d"), totalExpectedReproductionTime);
   1.725 +			StopTest(KErrNone, EFail);
   1.726 +			}
   1.727 +		}
   1.728 +	else
   1.729 +		{
   1.730 +		ERR_PRINTF2(_L("DevSound called ToneFinished with error = %d"), aError);
   1.731 +		ERR_PRINTF2(_L("Expected error = %d"), KErrUnderflow);
   1.732 +		StopTest(aError, EFail);
   1.733 +		}
   1.734 +	}
   1.735 +
   1.736 +/*
   1.737 + *========================================================================================================
   1.738 + * MM-A3F-DEVSOUND-CHRTZ-TONE-0007
   1.739 + */
   1.740 +RA3FDevSoundToneSetVolumeWhilePlayingTest::RA3FDevSoundToneSetVolumeWhilePlayingTest(const TDesC& aTestName)
   1.741 +	:	RA3FDevSoundTestBase(aTestName), iDuration(0),
   1.742 +		iVolume(0), iFrequencyTone1(0)
   1.743 +	{
   1.744 +	}
   1.745 +
   1.746 +RA3FDevSoundToneSetVolumeWhilePlayingTest* RA3FDevSoundToneSetVolumeWhilePlayingTest::NewL(const TDesC& aTestName)
   1.747 +	{
   1.748 +	RA3FDevSoundToneSetVolumeWhilePlayingTest * self = new(ELeave)RA3FDevSoundToneSetVolumeWhilePlayingTest(aTestName);
   1.749 +	return self;
   1.750 +	}
   1.751 +
   1.752 +void RA3FDevSoundToneSetVolumeWhilePlayingTest::DoKickoffTestL()
   1.753 +	{
   1.754 +	if (!GetIntFromConfig(iTestStepName, KVolume, iVolume))
   1.755 +		{
   1.756 +		ERR_PRINTF2(KMsgErrorGetParameter, &KVolume);
   1.757 +		StopTest(KErrNotFound);
   1.758 +		return;
   1.759 +		}
   1.760 +	if (!GetIntFromConfig(iTestStepName, KDuration, iDuration))
   1.761 +		{
   1.762 +		ERR_PRINTF2(KMsgErrorGetParameter, &KDuration);
   1.763 +		StopTest(KErrNotFound);
   1.764 +		return;
   1.765 +		}
   1.766 +	if (!GetIntFromConfig(iTestStepName, KFrequencyTone1, iFrequencyTone1))
   1.767 +		{
   1.768 +		ERR_PRINTF2(KMsgErrorGetParameter, &KFrequencyTone1);
   1.769 +		StopTest(KErrNotFound);
   1.770 +		return;
   1.771 +		}
   1.772 +	iTimer = CPeriodic::NewL(CActive::EPriorityHigh);
   1.773 +	}
   1.774 +
   1.775 +void RA3FDevSoundToneSetVolumeWhilePlayingTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError)
   1.776 +	{
   1.777 +	switch (iDevSoundState)
   1.778 +		{
   1.779 +		case EStateCreated:
   1.780 +			{
   1.781 +			if (aDevSoundEvent == EEventInitialize)
   1.782 +				{
   1.783 +				__ASSERT_ALWAYS((aError == KErrNone), Panic(_L("RA3FDevSoundToneSetVolumeWhilePlayingTest"), EFsmIncorrectErrorPassed));
   1.784 +				INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL"));
   1.785 +				TRAPD(err, iMMFDevSound->InitializeL(*this, EMMFStateTonePlaying));
   1.786 +				if (err != KErrNone)
   1.787 +					{
   1.788 +					ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err);
   1.789 +					StopTest(err);
   1.790 +					break;
   1.791 +					}
   1.792 +				INFO_PRINTF1(_L("DevSound State: EStateInitializing"));
   1.793 +				iDevSoundState = EStateInitializing;
   1.794 +				}
   1.795 +			else
   1.796 +				{
   1.797 +				ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent);
   1.798 +				StopTest(aError, EFail);
   1.799 +				}
   1.800 +			break;
   1.801 +			}
   1.802 +		case EStateInitializing:
   1.803 +			{
   1.804 +			if (aDevSoundEvent == EEventInitComplete && aError == KErrNone)
   1.805 +				{
   1.806 +				iStartTime.HomeTime();
   1.807 +				INFO_PRINTF3(_L("Calling CMMFDevSound::PlayToneL using frequency = %d Hz and duration = %d secs "), iFrequencyTone1, iDuration);
   1.808 +				TRAPD(err, iMMFDevSound->PlayToneL(iFrequencyTone1, iDuration*KMicroSecsInOneSec));
   1.809 +				if (err != KErrNone)
   1.810 +					{
   1.811 +					ERR_PRINTF2(_L("CMMFDevSound::PlayToneL left with error : %d!"), err);
   1.812 +					StopTest(err);
   1.813 +					break;
   1.814 +					}
   1.815 +				StartTimer(KMicroSecsTwoSec);
   1.816 +				INFO_PRINTF1(_L("DevSound State: EStatePlaying"));
   1.817 +				iDevSoundState = EStatePlaying;
   1.818 +				}
   1.819 +			else if (aDevSoundEvent == EEventInitComplete && aError != KErrNone)
   1.820 +				{
   1.821 +				ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error = %d"), aError);
   1.822 +				StopTest(aError);
   1.823 +				}
   1.824 +			else
   1.825 +				{
   1.826 +				ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent);
   1.827 +				StopTest(aError, EFail);
   1.828 +				}
   1.829 +			break;
   1.830 +			}
   1.831 +		default:
   1.832 +			{
   1.833 +			ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState);
   1.834 +			StopTest(aError, EFail);
   1.835 +			}
   1.836 +		}
   1.837 +	}
   1.838 +
   1.839 +void RA3FDevSoundToneSetVolumeWhilePlayingTest::DoTimerCallback()
   1.840 +	{
   1.841 +	iTimer->Cancel();
   1.842 +	INFO_PRINTF1(_L("DevSound Event: EEventTimerComplete"));
   1.843 +	INFO_PRINTF2(_L("Calling CMMFDevSound::SetVolume with volume value = %d"), iVolume);
   1.844 +	iMMFDevSound->SetVolume(iVolume);
   1.845 +	TInt volumeGet;
   1.846 +	volumeGet=iMMFDevSound->Volume();
   1.847 +	if (volumeGet == iVolume)
   1.848 +		{
   1.849 +		INFO_PRINTF2(_L("CMMFDevSound::SetVolume succeeded with value = %d"), volumeGet);
   1.850 +		}
   1.851 +	else
   1.852 +		{
   1.853 +		ERR_PRINTF2(_L("CMMFDevSound::SetVolume failed with value = %d"), volumeGet);
   1.854 +		ERR_PRINTF2(_L("Expected value = %d"), iVolume);
   1.855 +		StopTest(KErrNone, EFail);
   1.856 +		}
   1.857 +	}
   1.858 +
   1.859 +void RA3FDevSoundToneSetVolumeWhilePlayingTest::ToneFinished(TInt aError)
   1.860 +	{
   1.861 +	INFO_PRINTF1(_L("========== DevSound ToneFinished() callback =========="));
   1.862 +	if (aError == KErrUnderflow)
   1.863 +		{
   1.864 +		iEndTime.HomeTime();
   1.865 +		iPlayToneTime = iEndTime.MicroSecondsFrom(iStartTime);
   1.866 +		TInt totalExpectedReproductionTime = iDuration * KMicroSecsInOneSec;
   1.867 +		if(iPlayToneTime < totalExpectedReproductionTime + KPlayVarianceTime && iPlayToneTime > totalExpectedReproductionTime - KPlayVarianceTime)
   1.868 +			{
   1.869 +			INFO_PRINTF2(_L("Play time is %Ld microseconds"), iPlayToneTime.Int64());
   1.870 +			StopTest();
   1.871 +			}
   1.872 +		else
   1.873 +			{
   1.874 +			ERR_PRINTF3(_L("Play time is %Ld microseconds and it should have been %d microseconds"), iPlayToneTime.Int64(), totalExpectedReproductionTime);
   1.875 +			StopTest(KErrNone, EFail);
   1.876 +			}
   1.877 +		}
   1.878 +	else
   1.879 +		{
   1.880 +		ERR_PRINTF2(_L("DevSound called ToneFinished with error = %d"), aError);
   1.881 +		ERR_PRINTF2(_L("Expected error = %d"), KErrUnderflow);
   1.882 +		StopTest(aError, EFail);
   1.883 +		}
   1.884 +	}
   1.885 +
   1.886 +/*
   1.887 + *========================================================================================================
   1.888 + * MM-A3F-DEVSOUND-CHRTZ-TONE-0008
   1.889 + */
   1.890 +RA3FDevSoundToneSetPlayBalanceWhilePlayingTest::RA3FDevSoundToneSetPlayBalanceWhilePlayingTest(const TDesC& aTestName)
   1.891 +	:	RA3FDevSoundTestBase(aTestName), iDuration(0),
   1.892 +		iVolume(0), iFrequencyTone1(0), iLSpeakerBalance(0),
   1.893 +		iRSpeakerBalance(0)
   1.894 +
   1.895 +	{
   1.896 +	}
   1.897 +
   1.898 +RA3FDevSoundToneSetPlayBalanceWhilePlayingTest* RA3FDevSoundToneSetPlayBalanceWhilePlayingTest::NewL(const TDesC& aTestName)
   1.899 +	{
   1.900 +	RA3FDevSoundToneSetPlayBalanceWhilePlayingTest * self = new(ELeave)RA3FDevSoundToneSetPlayBalanceWhilePlayingTest(aTestName);
   1.901 +	return self;
   1.902 +	}
   1.903 +
   1.904 +void RA3FDevSoundToneSetPlayBalanceWhilePlayingTest::DoKickoffTestL()
   1.905 +	{
   1.906 +	if (!GetIntFromConfig(iTestStepName, KVolume, iVolume))
   1.907 +		{
   1.908 +		ERR_PRINTF2(KMsgErrorGetParameter, &KVolume);
   1.909 +		StopTest(KErrNotFound);
   1.910 +		return;
   1.911 +		}
   1.912 +	if (!GetIntFromConfig(iTestStepName, KDuration, iDuration))
   1.913 +		{
   1.914 +		ERR_PRINTF2(KMsgErrorGetParameter, &KDuration);
   1.915 +		StopTest(KErrNotFound);
   1.916 +		return;
   1.917 +		}
   1.918 +	if (!GetIntFromConfig(iTestStepName, KFrequencyTone1, iFrequencyTone1))
   1.919 +		{
   1.920 +		ERR_PRINTF2(KMsgErrorGetParameter, &KFrequencyTone1);
   1.921 +		StopTest(KErrNotFound);
   1.922 +		return;
   1.923 +		}
   1.924 +	if (!GetIntFromConfig(iTestStepName, KLSpeakerBalance, iLSpeakerBalance))
   1.925 +		{
   1.926 +		ERR_PRINTF2(KMsgErrorGetParameter, &KLSpeakerBalance);
   1.927 +		StopTest(KErrNotFound);
   1.928 +		return;
   1.929 +		}
   1.930 +	if (!GetIntFromConfig(iTestStepName, KRSpeakerBalance, iRSpeakerBalance))
   1.931 +		{
   1.932 +		ERR_PRINTF2(KMsgErrorGetParameter, &KRSpeakerBalance);
   1.933 +		StopTest(KErrNotFound);
   1.934 +		return;
   1.935 +		}
   1.936 +	iTimer = CPeriodic::NewL(CActive::EPriorityHigh);
   1.937 +	}
   1.938 +
   1.939 +void RA3FDevSoundToneSetPlayBalanceWhilePlayingTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError)
   1.940 +	{
   1.941 +	switch (iDevSoundState)
   1.942 +		{
   1.943 +		case EStateCreated:
   1.944 +			{
   1.945 +			if (aDevSoundEvent == EEventInitialize)
   1.946 +				{
   1.947 +				__ASSERT_ALWAYS((aError == KErrNone), Panic(_L("RA3FDevSoundToneSetPlayBalanceWhilePlayingTest"), EFsmIncorrectErrorPassed));
   1.948 +				INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL"));
   1.949 +				TRAPD(err, iMMFDevSound->InitializeL(*this, EMMFStateTonePlaying));
   1.950 +				if (err != KErrNone)
   1.951 +					{
   1.952 +					ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err);
   1.953 +					StopTest(err);
   1.954 +					break;
   1.955 +					}
   1.956 +				INFO_PRINTF1(_L("DevSound State: EStateInitializing"));
   1.957 +				iDevSoundState = EStateInitializing;
   1.958 +				}
   1.959 +			else
   1.960 +				{
   1.961 +				ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent);
   1.962 +				StopTest(aError, EFail);
   1.963 +				}
   1.964 +			break;
   1.965 +			}
   1.966 +		case EStateInitializing:
   1.967 +			{
   1.968 +			if (aDevSoundEvent == EEventInitComplete && aError == KErrNone)
   1.969 +				{
   1.970 +				iStartTime.HomeTime();
   1.971 +				INFO_PRINTF3(_L("Calling CMMFDevSound::PlayToneL using frequency = %d Hz and duration = %d secs "), iFrequencyTone1, iDuration);
   1.972 +				TRAPD(err, iMMFDevSound->PlayToneL(iFrequencyTone1, iDuration*KMicroSecsInOneSec));
   1.973 +				if (err != KErrNone)
   1.974 +					{
   1.975 +					ERR_PRINTF2(_L("CMMFDevSound::PlayToneL left with error : %d!"), err);
   1.976 +					StopTest(err);
   1.977 +					break;
   1.978 +					}
   1.979 +				StartTimer(KMicroSecsTwoSec);
   1.980 +				INFO_PRINTF1(_L("DevSound State: EStatePlaying"));
   1.981 +				iDevSoundState = EStatePlaying;
   1.982 +				}
   1.983 +			else if (aDevSoundEvent == EEventInitComplete && aError != KErrNone)
   1.984 +				{
   1.985 +				ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error = %d"), aError);
   1.986 +				StopTest(aError);
   1.987 +				}
   1.988 +			else
   1.989 +				{
   1.990 +				ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent);
   1.991 +				StopTest(aError, EFail);
   1.992 +				}
   1.993 +			break;
   1.994 +			}
   1.995 +		default:
   1.996 +			{
   1.997 +			ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState);
   1.998 +			StopTest(aError, EFail);
   1.999 +			}
  1.1000 +		}
  1.1001 +	}
  1.1002 +
  1.1003 +void RA3FDevSoundToneSetPlayBalanceWhilePlayingTest::DoTimerCallback()
  1.1004 +	{
  1.1005 +	iTimer->Cancel();
  1.1006 +	INFO_PRINTF1(_L("DevSound Event: EEventTimerComplete"));
  1.1007 +	INFO_PRINTF3(_L("Calling CMMFDevSound::SetPlayBalanceL using left = %d right = %d"), iLSpeakerBalance, iRSpeakerBalance);
  1.1008 +	TRAPD(err, iMMFDevSound->SetPlayBalanceL(iLSpeakerBalance, iRSpeakerBalance));
  1.1009 +	if (err == KErrNone)
  1.1010 +		{
  1.1011 +		TInt getBalanceL, getBalanceR;
  1.1012 +		TRAPD(err, iMMFDevSound->GetPlayBalanceL(getBalanceL, getBalanceR));
  1.1013 +		if (err == KErrNone)
  1.1014 +			{
  1.1015 +			if(iLSpeakerBalance == getBalanceL && iRSpeakerBalance == getBalanceR)
  1.1016 +				{
  1.1017 +				INFO_PRINTF3(_L("Calling CMMFDevSound::SetPlayBalanceL to set balance values succeeded, left = %d right = %d"), getBalanceL, getBalanceR);
  1.1018 +				}
  1.1019 +			else
  1.1020 +				{
  1.1021 +				ERR_PRINTF3(_L("Calling CMMFDevSound::SetPlayBalanceL to set balance values failed, left = %d right = %d"), getBalanceL, getBalanceR);
  1.1022 +				ERR_PRINTF3(_L("Expected balances values for right and left respectively %d, %d"),iLSpeakerBalance, iRSpeakerBalance);
  1.1023 +				StopTest(err,EFail);
  1.1024 +				}
  1.1025 +			}
  1.1026 +		}
  1.1027 +	else
  1.1028 +		{
  1.1029 +		ERR_PRINTF1(_L("Error in setting left and right play balance."));
  1.1030 +		StopTest (err, EFail);
  1.1031 +		}
  1.1032 +	}
  1.1033 +
  1.1034 +void RA3FDevSoundToneSetPlayBalanceWhilePlayingTest::ToneFinished(TInt aError)
  1.1035 +	{
  1.1036 +	INFO_PRINTF1(_L("========== DevSound ToneFinished() callback =========="));
  1.1037 +	if (aError == KErrUnderflow)
  1.1038 +		{
  1.1039 +		iEndTime.HomeTime();
  1.1040 +		iPlayToneTime = iEndTime.MicroSecondsFrom(iStartTime);
  1.1041 +		TInt totalExpectedReproductionTime = iDuration * KMicroSecsInOneSec;
  1.1042 +		if(iPlayToneTime < totalExpectedReproductionTime + KPlayVarianceTime && iPlayToneTime > totalExpectedReproductionTime - KPlayVarianceTime)
  1.1043 +			{
  1.1044 +			INFO_PRINTF2(_L("Play time is %Ld microseconds"), iPlayToneTime.Int64());
  1.1045 +			StopTest();
  1.1046 +			}
  1.1047 +		else
  1.1048 +			{
  1.1049 +			ERR_PRINTF3(_L("Play time is %Ld microseconds and it should have been %d microseconds"), iPlayToneTime.Int64(), totalExpectedReproductionTime);
  1.1050 +			StopTest(KErrNone, EFail);
  1.1051 +			}
  1.1052 +		}
  1.1053 +	else
  1.1054 +		{
  1.1055 +		ERR_PRINTF2(_L("DevSound called ToneFinished with error = %d"), aError);
  1.1056 +		ERR_PRINTF2(_L("Expected error = %d"), KErrUnderflow);
  1.1057 +		StopTest(aError, EFail);
  1.1058 +		}
  1.1059 +	}
  1.1060 +
  1.1061 +/*
  1.1062 + *  **========================================================================================================
  1.1063 + * MM-A3F-DEVSOUND-CHRTZ-TONE-0009
  1.1064 + */
  1.1065 +RA3FDevSoundToneSetVolumeWhilePausePlayingTest::RA3FDevSoundToneSetVolumeWhilePausePlayingTest(const TDesC& aTestName)
  1.1066 +	:	RA3FDevSoundTestBase(aTestName),
  1.1067 +		iDuration(0), iVolume(0),
  1.1068 +		iFrequencyTone1(0),
  1.1069 +		iTimeToEnterPauseElapsed(EFalse)
  1.1070 +	{
  1.1071 +	}
  1.1072 +
  1.1073 +RA3FDevSoundToneSetVolumeWhilePausePlayingTest* RA3FDevSoundToneSetVolumeWhilePausePlayingTest::NewL(const TDesC& aTestName)
  1.1074 +	{
  1.1075 +	RA3FDevSoundToneSetVolumeWhilePausePlayingTest * self = new(ELeave)RA3FDevSoundToneSetVolumeWhilePausePlayingTest(aTestName);
  1.1076 +	return self;
  1.1077 +	}
  1.1078 +
  1.1079 +void RA3FDevSoundToneSetVolumeWhilePausePlayingTest::DoKickoffTestL()
  1.1080 +	{
  1.1081 +	if (!GetIntFromConfig(iTestStepName, KVolume, iVolume))
  1.1082 +		{
  1.1083 +		ERR_PRINTF2(KMsgErrorGetParameter, &KVolume);
  1.1084 +		StopTest(KErrNotFound);
  1.1085 +		return;
  1.1086 +		}
  1.1087 +	if (!GetIntFromConfig(iTestStepName, KDuration, iDuration))
  1.1088 +		{
  1.1089 +		ERR_PRINTF2(KMsgErrorGetParameter, &KDuration);
  1.1090 +		StopTest(KErrNotFound);
  1.1091 +		return;
  1.1092 +		}
  1.1093 +	if (!GetIntFromConfig(iTestStepName, KFrequencyTone1, iFrequencyTone1))
  1.1094 +		{
  1.1095 +		ERR_PRINTF2(KMsgErrorGetParameter, &KFrequencyTone1);
  1.1096 +		StopTest(KErrNotFound);
  1.1097 +		return;
  1.1098 +		}
  1.1099 +	iTimer = CPeriodic::NewL(CActive::EPriorityHigh);
  1.1100 +	}
  1.1101 +
  1.1102 +void RA3FDevSoundToneSetVolumeWhilePausePlayingTest::Fsm(TMmfDevSoundEvent aDevSoundEvent,  TInt aError)
  1.1103 +	{
  1.1104 +	switch (iDevSoundState)
  1.1105 +		{
  1.1106 +		case EStateCreated:
  1.1107 +			{
  1.1108 +			__ASSERT_ALWAYS((aError == KErrNone), Panic(_L("RA3FDevSoundToneSetVolumeWhilePausePlayingTest"), EFsmIncorrectErrorPassed));
  1.1109 +			if (aDevSoundEvent == EEventInitialize)
  1.1110 +				{
  1.1111 +				INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL"));
  1.1112 +				TRAPD(err, iMMFDevSound->InitializeL(*this, EMMFStateTonePlaying));
  1.1113 +				if (err != KErrNone)
  1.1114 +					{
  1.1115 +					ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err);
  1.1116 +					StopTest(err);
  1.1117 +					break;
  1.1118 +					}
  1.1119 +				INFO_PRINTF1(_L("DevSound State: EStateInitializing"));
  1.1120 +				iDevSoundState = EStateInitializing;
  1.1121 +				}
  1.1122 +			else
  1.1123 +				{
  1.1124 +				ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent);
  1.1125 +				StopTest(aError, EFail);
  1.1126 +				}
  1.1127 +			break;
  1.1128 +			}
  1.1129 +		case EStateInitializing:
  1.1130 +			{
  1.1131 +			if (aDevSoundEvent == EEventInitComplete && aError == KErrNone)
  1.1132 +				{
  1.1133 +				INFO_PRINTF3(_L("CMMFDevSound::PlayToneL %d Hz during %d secs "), iFrequencyTone1, iDuration);
  1.1134 +				TRAPD(err, iMMFDevSound->PlayToneL(iFrequencyTone1, iDuration*KMicroSecsInOneSec));
  1.1135 +				if (err != KErrNone)
  1.1136 +					{
  1.1137 +					ERR_PRINTF2(_L("CMMFDevSound::PlayToneL left with error : %d!"), err);
  1.1138 +					StopTest(err);
  1.1139 +					break;
  1.1140 +					}
  1.1141 +				StartTimer(KMicroSecsTwoSec);
  1.1142 +				INFO_PRINTF1(_L("DevSound State: EStatePlaying"));
  1.1143 +				iDevSoundState = EStatePlaying;
  1.1144 +				}
  1.1145 +			else if (aDevSoundEvent == EEventInitComplete && aError != KErrNone)
  1.1146 +				{
  1.1147 +				ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error = %d"), aError);
  1.1148 +				StopTest(aError);
  1.1149 +				}
  1.1150 +			else
  1.1151 +				{
  1.1152 +				ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"),  aDevSoundEvent);
  1.1153 +				StopTest(aError, EFail);
  1.1154 +				}
  1.1155 +			break;
  1.1156 +			}
  1.1157 +		case EStatePlaying:
  1.1158 +			{
  1.1159 +			if(aDevSoundEvent == EEventTimerComplete)
  1.1160 +				{
  1.1161 +				INFO_PRINTF1(_L("Calling CMMFDevSound::Pause"));
  1.1162 +				iMMFDevSound->Pause();
  1.1163 +				INFO_PRINTF1(_L("DevSound State: EStatePause"));
  1.1164 +				iDevSoundState = EStatePause;
  1.1165 +				}
  1.1166 +			else
  1.1167 +				{
  1.1168 +				ERR_PRINTF2(_L("DevSound EEventTimerComplete not received as expected. Received event: %d"), aDevSoundEvent);
  1.1169 +				StopTest(aError, EFail);
  1.1170 +				}
  1.1171 +			break;
  1.1172 +			}
  1.1173 +		case EStatePause:
  1.1174 +			{
  1.1175 +			if(aDevSoundEvent == EEventTimerComplete)
  1.1176 +				{
  1.1177 +				INFO_PRINTF2(_L("Calling CMMFDevSound::SetVolume with volume value = %d"), iVolume);
  1.1178 +				iMMFDevSound->SetVolume(iVolume);
  1.1179 +				TInt volumeGet;
  1.1180 +				volumeGet=iMMFDevSound->Volume();
  1.1181 +				if (volumeGet == iVolume)
  1.1182 +					{
  1.1183 +					INFO_PRINTF2(_L("CMMFDevSound::SetVolume succeeded with value = %d"), volumeGet);
  1.1184 +					StopTest();
  1.1185 +					}
  1.1186 +				else
  1.1187 +					{
  1.1188 +					ERR_PRINTF2(_L("CMMFDevSound::SetVolume failed with value = %d"), volumeGet);
  1.1189 +					ERR_PRINTF2(_L("Expected value = %d"), iVolume);
  1.1190 +					StopTest(aError, EFail);
  1.1191 +					}
  1.1192 +				}
  1.1193 +			else
  1.1194 +				{
  1.1195 +				ERR_PRINTF2(_L("DevSound EEventTimerComplete not received as expected. Received event: %d"), aDevSoundEvent);
  1.1196 +				StopTest(aError, EFail);
  1.1197 +				}
  1.1198 +			break;
  1.1199 +			}
  1.1200 +		default:
  1.1201 +			{
  1.1202 +			ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState);
  1.1203 +			StopTest(aError, EFail);
  1.1204 +			}
  1.1205 +		}
  1.1206 +	}
  1.1207 +
  1.1208 +void RA3FDevSoundToneSetVolumeWhilePausePlayingTest::DoTimerCallback()
  1.1209 +	{
  1.1210 +	INFO_PRINTF1(_L("TimerEvent called"));
  1.1211 +	if(!iTimeToEnterPauseElapsed)
  1.1212 +		{
  1.1213 +		iTimeToEnterPauseElapsed = ETrue;
  1.1214 +		INFO_PRINTF1(_L("DevSound Event: EEventTimerComplete"));
  1.1215 +		Fsm(EEventTimerComplete, KErrNone);
  1.1216 +		iTimeToEnterPauseElapsed = ETrue;
  1.1217 +		}
  1.1218 +	else
  1.1219 +		{
  1.1220 +		iTimer->Cancel();
  1.1221 +		INFO_PRINTF1(_L("DevSound Event: EEventTimerComplete"));
  1.1222 +		Fsm(EEventTimerComplete, KErrNone);
  1.1223 +		}
  1.1224 +	}
  1.1225 +
  1.1226 +void RA3FDevSoundToneSetVolumeWhilePausePlayingTest::ToneFinished(TInt aError)
  1.1227 +	{
  1.1228 +	INFO_PRINTF1(_L("========== DevSound ToneFinished() callback =========="));
  1.1229 +	ERR_PRINTF1(_L("DevSound should not have called ToneFinished because it is supposed to be paused"));
  1.1230 +	StopTest(aError, EFail);
  1.1231 +	}
  1.1232 +/*
  1.1233 + *========================================================================================================
  1.1234 + * MM-A3F-DEVSOUND-CHRTZ-TONE-0010
  1.1235 + */
  1.1236 +RA3FDevSoundToneSetVolumeThenInitializeToPlayAudioTest::RA3FDevSoundToneSetVolumeThenInitializeToPlayAudioTest(const TDesC& aTestName)
  1.1237 +	:	RA3FDevSoundTestBase(aTestName), iVolume(0),
  1.1238 +		iReinitialized(EFalse)
  1.1239 +	{
  1.1240 +	}
  1.1241 +
  1.1242 +RA3FDevSoundToneSetVolumeThenInitializeToPlayAudioTest* RA3FDevSoundToneSetVolumeThenInitializeToPlayAudioTest::NewL(const TDesC& aTestName)
  1.1243 +	{
  1.1244 +	RA3FDevSoundToneSetVolumeThenInitializeToPlayAudioTest * self = new(ELeave)RA3FDevSoundToneSetVolumeThenInitializeToPlayAudioTest(aTestName);
  1.1245 +	return self;
  1.1246 +	}
  1.1247 +
  1.1248 +void RA3FDevSoundToneSetVolumeThenInitializeToPlayAudioTest::DoKickoffTestL()
  1.1249 +	{
  1.1250 +	if (!GetIntFromConfig(iTestStepName, KVolume, iVolume))
  1.1251 +		{
  1.1252 +		ERR_PRINTF2(KMsgErrorGetParameter, &KVolume);
  1.1253 +		StopTest(KErrNotFound);
  1.1254 +		return;
  1.1255 +		}
  1.1256 +	}
  1.1257 +
  1.1258 +void RA3FDevSoundToneSetVolumeThenInitializeToPlayAudioTest::Fsm(TMmfDevSoundEvent aDevSoundEvent,  TInt aError)
  1.1259 +	{
  1.1260 +	switch (iDevSoundState)
  1.1261 +		{
  1.1262 +		case EStateCreated:
  1.1263 +			{
  1.1264 +			__ASSERT_ALWAYS((aError == KErrNone), Panic(_L("RA3FDevSoundToneSetVolumeThenInitializeToPlayAudioTest"), EFsmIncorrectErrorPassed));
  1.1265 +			if (aDevSoundEvent == EEventInitialize)
  1.1266 +				{
  1.1267 +				INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL"));
  1.1268 +				TRAPD(err, iMMFDevSound->InitializeL(*this, EMMFStateTonePlaying));
  1.1269 +				if (err != KErrNone)
  1.1270 +					{
  1.1271 +					ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err);
  1.1272 +					StopTest(err);
  1.1273 +					break;
  1.1274 +					}
  1.1275 +				INFO_PRINTF1(_L("DevSound State: EStateInitializing"));
  1.1276 +				iDevSoundState = EStateInitializing;
  1.1277 +				}
  1.1278 +			else
  1.1279 +				{
  1.1280 +				ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent);
  1.1281 +				StopTest(aError, EFail);
  1.1282 +				}
  1.1283 +			break;
  1.1284 +			}
  1.1285 +		case EStateInitializing:
  1.1286 +			{
  1.1287 +			if (aDevSoundEvent == EEventInitComplete && aError == KErrNone)
  1.1288 +				{
  1.1289 +				if(!iReinitialized)
  1.1290 +					{
  1.1291 +					INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL"));
  1.1292 +					TRAPD(err, iMMFDevSound->InitializeL(*this, EMMFStateTonePlaying));
  1.1293 +					if (err != KErrNone)
  1.1294 +						{
  1.1295 +						ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err);
  1.1296 +						StopTest(err);
  1.1297 +						break;
  1.1298 +						}
  1.1299 +					INFO_PRINTF1(_L("DevSound State: EStateInitializing"));
  1.1300 +					iDevSoundState = EStateInitializing;
  1.1301 +					iReinitialized = ETrue;
  1.1302 +					INFO_PRINTF2(_L("Calling CMMFDevSound::SetVolume with volume value = %d"), iVolume);
  1.1303 +					iMMFDevSound->SetVolume(iVolume);
  1.1304 +					INFO_PRINTF1(_L("DevSound State: EStateInitializing"));
  1.1305 +					iDevSoundState = EStateInitializing;
  1.1306 +					}
  1.1307 +				else
  1.1308 +					{
  1.1309 +					TInt volumeGet;
  1.1310 +					volumeGet=iMMFDevSound->Volume();
  1.1311 +					if (volumeGet == iVolume)
  1.1312 +						{
  1.1313 +						INFO_PRINTF1(_L("After calling CMMFDevSound::InitializeL for playing audio, "));
  1.1314 +						INFO_PRINTF2(_L("the volume which was set when calling CMMFDevSound::InitializeL for playing tones is kept. Volume = %d"), volumeGet);
  1.1315 +						StopTest();
  1.1316 +						}
  1.1317 +					else
  1.1318 +						{
  1.1319 +						INFO_PRINTF1(_L("After calling CMMFDevSound::InitializeL for playing audio, "));
  1.1320 +						INFO_PRINTF2(_L("the volume which was set when calling CMMFDevSound::InitializeL for playing tones is  NOT kept. Volume = %d"), volumeGet);
  1.1321 +						ERR_PRINTF2(_L("Expected value = %d"), iVolume);
  1.1322 +						StopTest(aError, EFail);
  1.1323 +						}
  1.1324 +					}
  1.1325 +				}
  1.1326 +			else if (aDevSoundEvent == EEventInitComplete && aError != KErrNone)
  1.1327 +				{
  1.1328 +				ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error = %d"), aError);
  1.1329 +				StopTest(aError);
  1.1330 +				}
  1.1331 +			else
  1.1332 +				{
  1.1333 +				ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"),  aDevSoundEvent);
  1.1334 +				StopTest(aError, EFail);
  1.1335 +				}
  1.1336 +			break;
  1.1337 +			}
  1.1338 +		default:
  1.1339 +			{
  1.1340 +			ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState);
  1.1341 +			StopTest(aError, EFail);
  1.1342 +			}
  1.1343 +		}
  1.1344 +	}
  1.1345 +
  1.1346 +/*
  1.1347 + *========================================================================================================
  1.1348 + * MM-A3F-DEVSOUND-CHRTZ-TONE-0011
  1.1349 + */
  1.1350 +RA3FDevSoundToneSetVolumeRampWhilePlayingTest::RA3FDevSoundToneSetVolumeRampWhilePlayingTest(const TDesC& aTestName)
  1.1351 +	:	RA3FDevSoundTestBase(aTestName), iDuration(0),
  1.1352 +		iVolume(0), iFrequencyTone1(0),iTonePlayedTwice(EFalse),
  1.1353 +		iTimesToneFinishedCalled(0)
  1.1354 +	{
  1.1355 +	}
  1.1356 +
  1.1357 +RA3FDevSoundToneSetVolumeRampWhilePlayingTest* RA3FDevSoundToneSetVolumeRampWhilePlayingTest::NewL(const TDesC& aTestName)
  1.1358 +	{
  1.1359 +	RA3FDevSoundToneSetVolumeRampWhilePlayingTest * self = new(ELeave)RA3FDevSoundToneSetVolumeRampWhilePlayingTest(aTestName);
  1.1360 +	return self;
  1.1361 +	}
  1.1362 +
  1.1363 +void RA3FDevSoundToneSetVolumeRampWhilePlayingTest::DoKickoffTestL()
  1.1364 +	{
  1.1365 +	if (!GetIntFromConfig(iTestStepName, KVolume, iVolume))
  1.1366 +		{
  1.1367 +		ERR_PRINTF2(KMsgErrorGetParameter, &KVolume);
  1.1368 +		StopTest(KErrNotFound);
  1.1369 +		return;
  1.1370 +		}
  1.1371 +	if (!GetIntFromConfig(iTestStepName, KDuration, iDuration))
  1.1372 +		{
  1.1373 +		ERR_PRINTF2(KMsgErrorGetParameter, &KDuration);
  1.1374 +		StopTest(KErrNotFound);
  1.1375 +		return;
  1.1376 +		}
  1.1377 +	if (!GetIntFromConfig(iTestStepName, KFrequencyTone1, iFrequencyTone1))
  1.1378 +		{
  1.1379 +		ERR_PRINTF2(KMsgErrorGetParameter, &KFrequencyTone1);
  1.1380 +		StopTest(KErrNotFound);
  1.1381 +		return;
  1.1382 +		}
  1.1383 +	if (!GetIntFromConfig(iTestStepName, KVolumeRamp, iVolumeRamp))
  1.1384 +			{
  1.1385 +			ERR_PRINTF2(KMsgErrorGetParameter, &KVolumeRamp);
  1.1386 +			StopTest(KErrNotFound);
  1.1387 +			return;
  1.1388 +			}
  1.1389 +	iTimer = CPeriodic::NewL(CActive::EPriorityHigh);
  1.1390 +	}
  1.1391 +
  1.1392 +void RA3FDevSoundToneSetVolumeRampWhilePlayingTest::Fsm(TMmfDevSoundEvent aDevSoundEvent,  TInt aError)
  1.1393 +	{
  1.1394 +	switch (iDevSoundState)
  1.1395 +		{
  1.1396 +		case EStateCreated:
  1.1397 +			{
  1.1398 +			if (aDevSoundEvent == EEventInitialize)
  1.1399 +				{
  1.1400 +				__ASSERT_ALWAYS((aError == KErrNone), Panic(_L("RA3FDevSoundToneSetVolumeRampWhilePlayingTest"), EFsmIncorrectErrorPassed));
  1.1401 +				INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL"));
  1.1402 +				TRAPD(err, iMMFDevSound->InitializeL(*this, EMMFStateTonePlaying));
  1.1403 +				if (err != KErrNone)
  1.1404 +					{
  1.1405 +					ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"),  err);
  1.1406 +					StopTest(err);
  1.1407 +					break;
  1.1408 +					}
  1.1409 +				INFO_PRINTF1(_L("DevSound State: EStateInitializing"));
  1.1410 +				iDevSoundState = EStateInitializing;
  1.1411 +				}
  1.1412 +			else
  1.1413 +				{
  1.1414 +				ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent);
  1.1415 +				StopTest(aError, EFail);
  1.1416 +				}
  1.1417 +			break;
  1.1418 +			}
  1.1419 +		case EStateInitializing:
  1.1420 +			{
  1.1421 +			if (aDevSoundEvent == EEventInitComplete && aError == KErrNone)
  1.1422 +				{
  1.1423 +				iMMFDevSound->SetVolume(iMMFDevSound->MaxVolume());
  1.1424 +				iStartTime.HomeTime();
  1.1425 +				INFO_PRINTF3(_L("Calling CMMFDevSound::PlayToneL using frequency = %d Hz and duration = %d secs "), iFrequencyTone1, iDuration);
  1.1426 +				TRAPD(err, iMMFDevSound->PlayToneL(iFrequencyTone1, iDuration*KMicroSecsInOneSec));
  1.1427 +				if (err != KErrNone)
  1.1428 +					{
  1.1429 +					ERR_PRINTF2(_L("Play tone left with error : %d!"), err);
  1.1430 +					StopTest(err);
  1.1431 +					break;
  1.1432 +					}
  1.1433 +				StartTimer(KMicroSecsTwoSec);
  1.1434 +				INFO_PRINTF1(_L("DevSound State: EStatePlaying"));
  1.1435 +				iDevSoundState = EStatePlaying;
  1.1436 +				}
  1.1437 +			else if (aDevSoundEvent == EEventInitComplete && aError != KErrNone)
  1.1438 +				{
  1.1439 +				ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error = %d"), aError);
  1.1440 +				StopTest(aError);
  1.1441 +				}
  1.1442 +			else
  1.1443 +				{
  1.1444 +				ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent);
  1.1445 +				StopTest(aError, EFail);
  1.1446 +				}
  1.1447 +			break;
  1.1448 +			}
  1.1449 +		default:
  1.1450 +			{
  1.1451 +			ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState);
  1.1452 +			StopTest(aError, EFail);
  1.1453 +			}
  1.1454 +		}
  1.1455 +	}
  1.1456 +
  1.1457 +void RA3FDevSoundToneSetVolumeRampWhilePlayingTest::DoTimerCallback()
  1.1458 +	{
  1.1459 +	iTimer->Cancel();
  1.1460 +	INFO_PRINTF1(_L("DevSound Event: EEventTimerComplete"));
  1.1461 +	INFO_PRINTF2(_L("Calling CMMFDevSound::SetVolumeRamp using volume ramp time = %d"), iVolumeRamp);
  1.1462 +	iMMFDevSound->SetVolumeRamp(iVolumeRamp);
  1.1463 +	}
  1.1464 +
  1.1465 +void RA3FDevSoundToneSetVolumeRampWhilePlayingTest::ToneFinished(TInt aError)
  1.1466 +	{
  1.1467 +	INFO_PRINTF1(_L("========== DevSound ToneFinished() callback =========="));
  1.1468 +	if (aError == KErrUnderflow)
  1.1469 +		{
  1.1470 +		TInt totalExpectedReproductionTime;
  1.1471 +		iTimesToneFinishedCalled++;
  1.1472 +		totalExpectedReproductionTime = iDuration * iTimesToneFinishedCalled * KMicroSecsInOneSec;
  1.1473 +		iEndTime.HomeTime();
  1.1474 +		iPlayToneTime = iEndTime.MicroSecondsFrom(iStartTime);
  1.1475 +		if(!iTonePlayedTwice)
  1.1476 +			{
  1.1477 +			INFO_PRINTF2(_L("DevSound called ToneFinished with error = %d"), aError);
  1.1478 +			INFO_PRINTF3(_L("Calling CMMFDevSound::PlayToneL using frequency = %d Hz and duration = %d secs "), iFrequencyTone1, iDuration);
  1.1479 +			TRAPD(err, iMMFDevSound->PlayToneL(iFrequencyTone1, iDuration*KMicroSecsInOneSec));
  1.1480 +			if (err != KErrNone)
  1.1481 +				{
  1.1482 +				ERR_PRINTF2(_L("CMMFDevSound::PlayToneL with error : %d!"), err);
  1.1483 +				StopTest(err);
  1.1484 +				}
  1.1485 +			iTonePlayedTwice = ETrue;
  1.1486 +			}
  1.1487 +		else if (iPlayToneTime < totalExpectedReproductionTime + (2*KPlayVarianceTime) && iPlayToneTime > totalExpectedReproductionTime - (2*KPlayVarianceTime))
  1.1488 +			{
  1.1489 +			INFO_PRINTF2(_L("DevSound called ToneFinished twice with error = %d"), aError);
  1.1490 +			INFO_PRINTF2(_L("Play time is %Ld microseconds"), iPlayToneTime.Int64());
  1.1491 +			StopTest();
  1.1492 +			}
  1.1493 +		else
  1.1494 +			{
  1.1495 +			ERR_PRINTF3(_L("Play time is %Ld microseconds and it should have been %d microseconds"), iPlayToneTime.Int64(), totalExpectedReproductionTime);
  1.1496 +			StopTest(KErrNone, EFail);
  1.1497 +			}
  1.1498 +		}
  1.1499 +	else
  1.1500 +		{
  1.1501 +		ERR_PRINTF2(_L("DevSound called ToneFinished with error = %d"), aError);
  1.1502 +		ERR_PRINTF2(_L("Expected error = %d"), KErrUnderflow);
  1.1503 +		StopTest(aError, EFail);
  1.1504 +		}
  1.1505 +	}
  1.1506 +
  1.1507 +/*
  1.1508 + *========================================================================================================
  1.1509 + * MM-A3F-DEVSOUND-CHRTZ-TONE-0012
  1.1510 + */
  1.1511 +RA3FDevSoundToneSetToneRepetitionsWhilePlayingTest::RA3FDevSoundToneSetToneRepetitionsWhilePlayingTest(const TDesC& aTestName)
  1.1512 +	:	RA3FDevSoundTestBase(aTestName),
  1.1513 +		iDuration(0),
  1.1514 +		iFrequencyTone1(0),
  1.1515 +		iRepeatTrailingSilence(0),
  1.1516 +		iRepeatCount(0)
  1.1517 +	{
  1.1518 +	}
  1.1519 +
  1.1520 +RA3FDevSoundToneSetToneRepetitionsWhilePlayingTest* RA3FDevSoundToneSetToneRepetitionsWhilePlayingTest::NewL(const TDesC& aTestName)
  1.1521 +	{
  1.1522 +	RA3FDevSoundToneSetToneRepetitionsWhilePlayingTest * self = new(ELeave)RA3FDevSoundToneSetToneRepetitionsWhilePlayingTest(aTestName);
  1.1523 +	return self;
  1.1524 +	}
  1.1525 +
  1.1526 +void RA3FDevSoundToneSetToneRepetitionsWhilePlayingTest::DoKickoffTestL()
  1.1527 +	{
  1.1528 +	if (!GetIntFromConfig(iTestStepName, KRepeatCount, iRepeatCount))
  1.1529 +		{
  1.1530 +		ERR_PRINTF2(KMsgErrorGetParameter, &KRepeatCount);
  1.1531 +		StopTest(KErrNotFound);
  1.1532 +		return;
  1.1533 +		}
  1.1534 +	if (!GetIntFromConfig(iTestStepName, KRepeatTrailingSilence, iRepeatTrailingSilence))
  1.1535 +		{
  1.1536 +		ERR_PRINTF2(KMsgErrorGetParameter, &KRepeatTrailingSilence);
  1.1537 +		StopTest(KErrNotFound);
  1.1538 +		return;
  1.1539 +		}
  1.1540 +	if (!GetIntFromConfig(iTestStepName, KDuration, iDuration))
  1.1541 +		{
  1.1542 +		ERR_PRINTF2(KMsgErrorGetParameter, &KDuration);
  1.1543 +		StopTest(KErrNotFound);
  1.1544 +		return;
  1.1545 +		}
  1.1546 +	if (!GetIntFromConfig(iTestStepName, KFrequencyTone1, iFrequencyTone1))
  1.1547 +		{
  1.1548 +		ERR_PRINTF2(KMsgErrorGetParameter, &KFrequencyTone1);
  1.1549 +		StopTest(KErrNotFound);
  1.1550 +		return;
  1.1551 +		}
  1.1552 +	iTimer = CPeriodic::NewL(CActive::EPriorityHigh);
  1.1553 +	}
  1.1554 +
  1.1555 +void RA3FDevSoundToneSetToneRepetitionsWhilePlayingTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError)
  1.1556 +	{
  1.1557 +	switch (iDevSoundState)
  1.1558 +		{
  1.1559 +		case EStateCreated:
  1.1560 +			{
  1.1561 +			__ASSERT_ALWAYS((aError == KErrNone), Panic(_L("RA3FDevSoundToneSetToneRepetitionsWhilePlayingConfigurationTest"), EFsmIncorrectErrorPassed));
  1.1562 +			if(aDevSoundEvent == EEventInitialize)
  1.1563 +				{
  1.1564 +				INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL"));
  1.1565 +				TRAPD(err, iMMFDevSound->InitializeL(*this, EMMFStateTonePlaying));
  1.1566 +				if (err != KErrNone)
  1.1567 +					{
  1.1568 +					ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err);
  1.1569 +					StopTest(err);
  1.1570 +					break;
  1.1571 +					}
  1.1572 +				INFO_PRINTF1(_L("DevSound State: EStateInitializing"));
  1.1573 +				iDevSoundState = EStateInitializing;
  1.1574 +				}
  1.1575 +			else
  1.1576 +				{
  1.1577 +				ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent);
  1.1578 +				StopTest(aError, EFail);
  1.1579 +				}
  1.1580 +			break;
  1.1581 +			}
  1.1582 +		case EStateInitializing:
  1.1583 +			{
  1.1584 +			if (aDevSoundEvent == EEventInitComplete && aError == KErrNone)
  1.1585 +				{
  1.1586 +				iMMFDevSound->SetVolume(iMMFDevSound->MaxVolume());
  1.1587 +				iStartTime.HomeTime();
  1.1588 +				INFO_PRINTF3(_L("Calling CMMFDevSound::PlayToneL %d Hz during %d secs "), iFrequencyTone1, iDuration);
  1.1589 +				TRAPD(err, iMMFDevSound->PlayToneL(iFrequencyTone1, iDuration*KMicroSecsInOneSec));
  1.1590 +				if (err != KErrNone)
  1.1591 +					{
  1.1592 +					ERR_PRINTF2(_L("CMMFDevSound::PlayToneL left with error : %d!"), err);
  1.1593 +					StopTest(err);
  1.1594 +					break;
  1.1595 +					}
  1.1596 +				StartTimer(KMicroSecsTwoSec);
  1.1597 +				INFO_PRINTF1(_L("DevSound State: EStatePlaying"));
  1.1598 +				iDevSoundState = EStatePlaying;
  1.1599 +				}
  1.1600 +			else if (aDevSoundEvent == EEventInitComplete && aError != KErrNone)
  1.1601 +				{
  1.1602 +				ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error = %d"), aError);
  1.1603 +				StopTest(aError);
  1.1604 +				}
  1.1605 +			else
  1.1606 +				{
  1.1607 +				ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent);
  1.1608 +				StopTest(aError, EFail);
  1.1609 +				}
  1.1610 +			break;
  1.1611 +			}
  1.1612 +		default:
  1.1613 +			{
  1.1614 +			ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState);
  1.1615 +			StopTest(aError, EFail);
  1.1616 +			}
  1.1617 +		}
  1.1618 +	}
  1.1619 +
  1.1620 +void RA3FDevSoundToneSetToneRepetitionsWhilePlayingTest::DoTimerCallback()
  1.1621 +	{
  1.1622 +	iTimer->Cancel();
  1.1623 +	INFO_PRINTF1(_L("DevSound Event: EEventTimerComplete"));
  1.1624 +	INFO_PRINTF3(_L("Calling CMMFDevSound::SetToneRepeats using RepeatCount = %d and RepeatTrailingSilence = %d microsecs"), iRepeatCount, iRepeatTrailingSilence);
  1.1625 +	iMMFDevSound->SetToneRepeats(iRepeatCount, iRepeatTrailingSilence);
  1.1626 +	}
  1.1627 +
  1.1628 +void RA3FDevSoundToneSetToneRepetitionsWhilePlayingTest::ToneFinished(TInt aError)
  1.1629 +	{
  1.1630 +	INFO_PRINTF1(_L("========== DevSound ToneFinished() callback =========="));
  1.1631 +	const TInt KtimesPlayToneIsCalled = 2;
  1.1632 +	if (aError == KErrUnderflow)
  1.1633 +		{
  1.1634 +		iEndTime.HomeTime();
  1.1635 +		iPlayToneTime = iEndTime.MicroSecondsFrom(iStartTime);
  1.1636 +		TInt repeatTrailingSilenceToSecs = iRepeatTrailingSilence/KMicroSecsInOneSec;
  1.1637 +		TInt totalExpectedReproductionTime = (KtimesPlayToneIsCalled*iDuration+iRepeatCount*iDuration + (repeatTrailingSilenceToSecs*iRepeatCount))*KMicroSecsInOneSec;
  1.1638 +		if(iPlayToneTime < ((iDuration*KMicroSecsInOneSec) + KPlayVarianceTime)&& iPlayToneTime > (iDuration*KMicroSecsInOneSec) - KPlayVarianceTime)
  1.1639 +			{
  1.1640 +			INFO_PRINTF1(_L("First play tone succeded."));
  1.1641 +			INFO_PRINTF2(_L("Play time is %Ld microseconds"), iPlayToneTime.Int64());
  1.1642 +			TRAPD(err, iMMFDevSound->PlayToneL(iFrequencyTone1, iDuration*KMicroSecsInOneSec));
  1.1643 +			if (err != KErrNone)
  1.1644 +				{
  1.1645 +				ERR_PRINTF2(_L("CMMFDevSound::PlayToneL failed with error : %d!"), err);
  1.1646 +				StopTest(err);
  1.1647 +				}
  1.1648 +			}
  1.1649 +		else if(iPlayToneTime < totalExpectedReproductionTime + KPlayVarianceTime && iPlayToneTime > totalExpectedReproductionTime - KPlayVarianceTime)
  1.1650 +			{
  1.1651 +			INFO_PRINTF1(_L("Play tone repeats succeded."));
  1.1652 +			INFO_PRINTF2(_L("Play time is %Ld microseconds"), iPlayToneTime.Int64());
  1.1653 +			StopTest();
  1.1654 +			}
  1.1655 +		else
  1.1656 +			{
  1.1657 +			ERR_PRINTF1(_L("Play tone repeats did not work as planned."));
  1.1658 +			ERR_PRINTF3(_L("Play time is %Ld microseconds and it should have been %d microseconds"), iPlayToneTime.Int64(), totalExpectedReproductionTime);
  1.1659 +			StopTest(KErrNone, EFail);
  1.1660 +			}
  1.1661 +		}
  1.1662 +	else
  1.1663 +		{
  1.1664 +		ERR_PRINTF2(_L("DevSound called ToneFinished with error = %d"), aError);
  1.1665 +		ERR_PRINTF2(_L("Expected error = %d"), KErrUnderflow);
  1.1666 +		StopTest(aError, EFail);
  1.1667 +		}
  1.1668 +	}
  1.1669 +
  1.1670 +/*
  1.1671 + *========================================================================================================
  1.1672 + * MM-A3F-DEVSOUND-CHRTZ-TONE-0013
  1.1673 + */
  1.1674 +RA3FDevSoundToneSetDTMFLengthsWhilePlayingTest::RA3FDevSoundToneSetDTMFLengthsWhilePlayingTest(const TDesC& aTestName)
  1.1675 +	:	RA3FDevSoundTestBase(aTestName),
  1.1676 +		iFirstToneFinishedCall(EFalse),
  1.1677 +		iToneOnLength(0), iToneOffLength(0),
  1.1678 +		iPauseLength(0), iDTMFString(KNullDesC),
  1.1679 +		iDTMFPauses(0), iDTMFTones(0),
  1.1680 +		iTotalExpectedPlayToneTime(0)
  1.1681 +	{
  1.1682 +	}
  1.1683 +RA3FDevSoundToneSetDTMFLengthsWhilePlayingTest* RA3FDevSoundToneSetDTMFLengthsWhilePlayingTest::NewL(const TDesC& aTestName)
  1.1684 +	{
  1.1685 +	RA3FDevSoundToneSetDTMFLengthsWhilePlayingTest * self = new(ELeave)RA3FDevSoundToneSetDTMFLengthsWhilePlayingTest(aTestName);
  1.1686 +	return self;
  1.1687 +	}
  1.1688 +
  1.1689 +void RA3FDevSoundToneSetDTMFLengthsWhilePlayingTest::DoKickoffTestL()
  1.1690 +	{
  1.1691 +	if (!GetIntFromConfig(iTestStepName, KToneOnLength, iToneOnLength))
  1.1692 +		{
  1.1693 +		ERR_PRINTF2(KMsgErrorGetParameter, &KToneOnLength);
  1.1694 +		StopTest(KErrNotFound);
  1.1695 +		return;
  1.1696 +		}
  1.1697 +	if (!GetIntFromConfig(iTestStepName, KToneOffLength, iToneOffLength))
  1.1698 +		{
  1.1699 +		ERR_PRINTF2(KMsgErrorGetParameter, &KToneOffLength);
  1.1700 +		StopTest(KErrNotFound);
  1.1701 +		return;
  1.1702 +		}
  1.1703 +	if (!GetIntFromConfig(iTestStepName, KPauseLength, iPauseLength))
  1.1704 +		{
  1.1705 +		ERR_PRINTF2(KMsgErrorGetParameter, &KPauseLength);
  1.1706 +		StopTest(KErrNotFound);
  1.1707 +		return;
  1.1708 +		}
  1.1709 +	TPtrC DTMF;
  1.1710 +	if (!GetStringFromConfig(iTestStepName, KDTMFString, DTMF))
  1.1711 +		{
  1.1712 +		ERR_PRINTF2(KMsgErrorGetParameter, &KDTMFString);
  1.1713 +		StopTest(KErrNotFound);
  1.1714 +		return;
  1.1715 +		}
  1.1716 +	iDTMFString.Copy(DTMF);
  1.1717 +	for(TInt i =0 ; i< iDTMFString.Length() ; i++)
  1.1718 +		{
  1.1719 +		if (iDTMFString[i] == ',')
  1.1720 +			{
  1.1721 +			iDTMFPauses++;
  1.1722 +			}
  1.1723 +		else
  1.1724 +			{
  1.1725 +			iDTMFTones++;
  1.1726 +			}
  1.1727 +		}
  1.1728 +	iTimer = CPeriodic::NewL(CActive::EPriorityHigh);
  1.1729 +	}
  1.1730 +
  1.1731 +void RA3FDevSoundToneSetDTMFLengthsWhilePlayingTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError)
  1.1732 +	{
  1.1733 +	switch (iDevSoundState)
  1.1734 +		{
  1.1735 +		case EStateCreated:
  1.1736 +			{
  1.1737 +			__ASSERT_ALWAYS((aError == KErrNone), Panic(_L("RA3FDevSoundToneSetDTMFToneRepetitionsWhilePlayingConfigurationTest"), EFsmIncorrectErrorPassed));
  1.1738 +			if(aDevSoundEvent == EEventInitialize)
  1.1739 +				{
  1.1740 +				INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL"));
  1.1741 +				TRAPD(err, iMMFDevSound->InitializeL(*this, EMMFStateTonePlaying));
  1.1742 +				if (err != KErrNone)
  1.1743 +					{
  1.1744 +					ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err);
  1.1745 +					StopTest(err);
  1.1746 +					break;
  1.1747 +					}
  1.1748 +				INFO_PRINTF1(_L("DevSound State: EStateInitializing"));
  1.1749 +				iDevSoundState = EStateInitializing;
  1.1750 +				}
  1.1751 +			else
  1.1752 +				{
  1.1753 +				ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent);
  1.1754 +				StopTest(aError, EFail);
  1.1755 +				}
  1.1756 +			break;
  1.1757 +			}
  1.1758 +		case EStateInitializing:
  1.1759 +			{
  1.1760 +			if (aDevSoundEvent == EEventInitComplete && aError == KErrNone)
  1.1761 +				{
  1.1762 +				iMMFDevSound->SetVolume(iMMFDevSound->MaxVolume());
  1.1763 +				iStartTime.HomeTime();
  1.1764 +				INFO_PRINTF2(_L("Calling CMMFDevSound::L %S"), &iDTMFString);
  1.1765 +				TRAPD(err, iMMFDevSound->PlayDTMFStringL(iDTMFString));
  1.1766 +				if (err != KErrNone)
  1.1767 +					{
  1.1768 +					ERR_PRINTF2(_L("CMMFDevSound::PlayDTMFStringL left with error : %d!"), err);
  1.1769 +					StopTest(err);
  1.1770 +					break;
  1.1771 +					}
  1.1772 +				StartTimer(KMicroSecsTwoSec);
  1.1773 +				INFO_PRINTF1(_L("DevSound State: EStatePlaying"));
  1.1774 +				iDevSoundState=EStatePlaying;
  1.1775 +				}
  1.1776 +			else if (aDevSoundEvent == EEventInitComplete && aError != KErrNone)
  1.1777 +				{
  1.1778 +				ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error = %d"), aError);
  1.1779 +				StopTest(aError);
  1.1780 +				}
  1.1781 +			else
  1.1782 +				{
  1.1783 +				ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent);
  1.1784 +				StopTest(aError, EFail);
  1.1785 +				}
  1.1786 +			break;
  1.1787 +			}
  1.1788 +		default:
  1.1789 +			{
  1.1790 +			ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState);
  1.1791 +			StopTest(aError, EFail);
  1.1792 +			}
  1.1793 +		}
  1.1794 +	}
  1.1795 +
  1.1796 +void RA3FDevSoundToneSetDTMFLengthsWhilePlayingTest::DoTimerCallback()
  1.1797 +	{
  1.1798 +	iTimer->Cancel();
  1.1799 +	INFO_PRINTF1(_L("DevSound Event: EEventTimerComplete"));
  1.1800 +	TTimeIntervalMicroSeconds32 ToneOnLength(iToneOnLength);
  1.1801 +	TTimeIntervalMicroSeconds32 ToneOffLength(iToneOffLength);
  1.1802 +	TTimeIntervalMicroSeconds32 PauseLength(iPauseLength);
  1.1803 +	INFO_PRINTF4(_L("Calling CMMFDevSound::SetDTMFLengths. ToneOnLength = %d, ToneOffLength = %d and PauseLength = %d"), ToneOnLength.Int(), ToneOffLength.Int(), PauseLength.Int());
  1.1804 +	iMMFDevSound->SetDTMFLengths(ToneOnLength, ToneOffLength, PauseLength);
  1.1805 +	}
  1.1806 +
  1.1807 +void RA3FDevSoundToneSetDTMFLengthsWhilePlayingTest::ToneFinished(TInt aError)
  1.1808 +	{
  1.1809 +	INFO_PRINTF1(_L("========== DevSound ToneFinished() callback =========="));
  1.1810 +	if (aError == KErrUnderflow)
  1.1811 +		{
  1.1812 +		iEndTime.HomeTime();
  1.1813 +		iPlayToneTime = iEndTime.MicroSecondsFrom(iStartTime);
  1.1814 +		if (!iFirstToneFinishedCall)
  1.1815 +			{
  1.1816 +			INFO_PRINTF1(_L("First play tone succeded"));
  1.1817 +			INFO_PRINTF2(_L("Play time is %Ld microseconds"), iPlayToneTime.Int64());
  1.1818 +			iFirstToneFinishedCall = ETrue;
  1.1819 +			INFO_PRINTF2(_L("Calling CMMFDevSound::PlayDTMFStringL %S"), &iDTMFString);
  1.1820 +			TRAPD(err, iMMFDevSound->PlayDTMFStringL(iDTMFString));
  1.1821 +			if (err != KErrNone)
  1.1822 +				{
  1.1823 +				ERR_PRINTF2(_L("CMMFDevSound::PlayDTMFStringL left with error = %d"), err);
  1.1824 +				StopTest(err);
  1.1825 +				}
  1.1826 +			iTotalExpectedPlayToneTime = iToneOnLength*iDTMFTones + iToneOffLength * iDTMFTones + iDTMFPauses * iPauseLength + iPlayToneTime.Int64();
  1.1827 +			return;
  1.1828 +			}
  1.1829 +		if (iPlayToneTime.Int64() < iTotalExpectedPlayToneTime + KPlayVarianceTime && iPlayToneTime.Int64() > iTotalExpectedPlayToneTime - KPlayVarianceTime)
  1.1830 +			{
  1.1831 +			INFO_PRINTF1(_L("Calling CMMFDevSound::SetDTMFLengths succeded."));
  1.1832 +			INFO_PRINTF2(_L("Play time is %Ld microseconds"), iPlayToneTime.Int64());
  1.1833 +			StopTest();
  1.1834 +			}
  1.1835 +		else
  1.1836 +			{
  1.1837 +			ERR_PRINTF2(_L("Calling CMMFDevSound::SetDTMFLengths failed with %Ld"), iPlayToneTime.Int64());
  1.1838 +			ERR_PRINTF2(_L("Expected time %d"), iTotalExpectedPlayToneTime);
  1.1839 +			StopTest(KErrNone, EFail);
  1.1840 +			}
  1.1841 +		}
  1.1842 +	else
  1.1843 +		{
  1.1844 +		ERR_PRINTF2(_L("DevSound called ToneFinished with error = %d"), aError);
  1.1845 +		ERR_PRINTF2(_L("Expected error = %Ld"), KErrUnderflow);
  1.1846 +		StopTest(aError, EFail);
  1.1847 +		}
  1.1848 +	}
  1.1849 +
  1.1850 +/*
  1.1851 + *========================================================================================================
  1.1852 + * MM-A3F-DEVSOUND-CHRTZ-TONE-0014
  1.1853 + */
  1.1854 +RA3FDevSoundToneSetToneRepetitionsNotPlayingTonesModeTest::RA3FDevSoundToneSetToneRepetitionsNotPlayingTonesModeTest(const TDesC& aTestName)
  1.1855 +	:	RA3FDevSoundTestBase(aTestName), iDuration(0),
  1.1856 +		iFrequencyTone1(0),
  1.1857 +		iRepeatTrailingSilence(0), iRepeatCount(0),
  1.1858 +		iInitializedToPlayTones(EFalse)
  1.1859 +	{
  1.1860 +	}
  1.1861 +
  1.1862 +RA3FDevSoundToneSetToneRepetitionsNotPlayingTonesModeTest* RA3FDevSoundToneSetToneRepetitionsNotPlayingTonesModeTest::NewL(const TDesC& aTestName)
  1.1863 +	{
  1.1864 +	RA3FDevSoundToneSetToneRepetitionsNotPlayingTonesModeTest * self = new(ELeave)RA3FDevSoundToneSetToneRepetitionsNotPlayingTonesModeTest(aTestName);
  1.1865 +	return self;
  1.1866 +	}
  1.1867 +
  1.1868 +void RA3FDevSoundToneSetToneRepetitionsNotPlayingTonesModeTest::DoKickoffTestL()
  1.1869 +	{
  1.1870 +	if (!GetIntFromConfig(iTestStepName, KRepeatCount, iRepeatCount))
  1.1871 +		{
  1.1872 +		ERR_PRINTF2(KMsgErrorGetParameter, &KRepeatCount);
  1.1873 +		StopTest(KErrNotFound);
  1.1874 +		return;
  1.1875 +		}
  1.1876 +	if (!GetIntFromConfig(iTestStepName, KRepeatTrailingSilence, iRepeatTrailingSilence))
  1.1877 +		{
  1.1878 +		ERR_PRINTF2(KMsgErrorGetParameter, &KRepeatTrailingSilence);
  1.1879 +		StopTest(KErrNotFound);
  1.1880 +		return;
  1.1881 +		}
  1.1882 +	if (!GetIntFromConfig(iTestStepName, KDuration, iDuration))
  1.1883 +		{
  1.1884 +		ERR_PRINTF2(KMsgErrorGetParameter, &KDuration);
  1.1885 +		StopTest(KErrNotFound);
  1.1886 +		return;
  1.1887 +		}
  1.1888 +	if (!GetIntFromConfig(iTestStepName, KFrequencyTone1, iFrequencyTone1))
  1.1889 +		{
  1.1890 +		ERR_PRINTF2(KMsgErrorGetParameter, &KFrequencyTone1);
  1.1891 +		StopTest(KErrNotFound);
  1.1892 +		return;
  1.1893 +		}
  1.1894 +	}
  1.1895 +
  1.1896 +void RA3FDevSoundToneSetToneRepetitionsNotPlayingTonesModeTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError)
  1.1897 +	{
  1.1898 +	switch (iDevSoundState)
  1.1899 +		{
  1.1900 +		case EStateCreated:
  1.1901 +			{
  1.1902 +			__ASSERT_ALWAYS((aError == KErrNone), Panic(_L("RA3FDevSoundToneSetToneRepetitionsNotPlayingTonesModeConfigurationTest"), EFsmIncorrectErrorPassed));
  1.1903 +			if(aDevSoundEvent == EEventInitialize)
  1.1904 +				{
  1.1905 +				INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL"));
  1.1906 +				TRAPD(err, iMMFDevSound->InitializeL(*this, EMMFStatePlaying));
  1.1907 +				if (err != KErrNone)
  1.1908 +					{
  1.1909 +					ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err);
  1.1910 +					StopTest(err);
  1.1911 +					break;
  1.1912 +					}
  1.1913 +				INFO_PRINTF1(_L("DevSound State: EStateInitializing"));
  1.1914 +				iDevSoundState = EStateInitializing;
  1.1915 +				}
  1.1916 +			else
  1.1917 +				{
  1.1918 +				ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent);
  1.1919 +				StopTest(aError, EFail);
  1.1920 +				}
  1.1921 +			break;
  1.1922 +			}
  1.1923 +		case EStateInitializing:
  1.1924 +			{
  1.1925 +			if (aDevSoundEvent == EEventInitComplete && aError == KErrNone)
  1.1926 +				{
  1.1927 +				if(!iInitializedToPlayTones)
  1.1928 +					{
  1.1929 +					INFO_PRINTF3(_L("Calling CMMFDevSound::SetToneRepeats using RepeatCount = %d and RepeatTrailingSilence = %d microsecs"), iRepeatCount, iRepeatTrailingSilence);
  1.1930 +					iMMFDevSound->SetToneRepeats(iRepeatCount, iRepeatTrailingSilence);
  1.1931 +					INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL for playing tones"));
  1.1932 +					TRAPD(err, iMMFDevSound->InitializeL(*this, EMMFStateTonePlaying));
  1.1933 +					if (err != KErrNone)
  1.1934 +						{
  1.1935 +						ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err);
  1.1936 +						StopTest(err);
  1.1937 +						break;
  1.1938 +						}
  1.1939 +					iInitializedToPlayTones = ETrue;
  1.1940 +					}
  1.1941 +				else
  1.1942 +					{
  1.1943 +					iMMFDevSound->SetVolume(iMMFDevSound->MaxVolume());
  1.1944 +					iStartTime.HomeTime();
  1.1945 +					INFO_PRINTF3(_L("Calling CMMFDevSound::PlayToneL %d Hz during %d secs "), iFrequencyTone1, iDuration);
  1.1946 +					TRAPD(err, iMMFDevSound->PlayToneL(iFrequencyTone1, iDuration*KMicroSecsInOneSec));
  1.1947 +					if (err != KErrNone)
  1.1948 +						{
  1.1949 +						ERR_PRINTF2(_L("CMMFDevSound::PlayToneL left with error : %d!"), err);
  1.1950 +						StopTest(err);
  1.1951 +						break;
  1.1952 +						}
  1.1953 +					INFO_PRINTF1(_L("DevSound State: EStatePlaying"));
  1.1954 +					iDevSoundState = EStatePlaying;
  1.1955 +					}
  1.1956 +				}
  1.1957 +			else if (aDevSoundEvent == EEventInitComplete && aError != KErrNone)
  1.1958 +				{
  1.1959 +				ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error = %d"), aError);
  1.1960 +				StopTest(aError);
  1.1961 +				}
  1.1962 +			else
  1.1963 +				{
  1.1964 +				ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent);
  1.1965 +				StopTest(aError, EFail);
  1.1966 +				}
  1.1967 +			break;
  1.1968 +			}
  1.1969 +		default:
  1.1970 +			{
  1.1971 +			ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState);
  1.1972 +			StopTest(aError, EFail);
  1.1973 +			}
  1.1974 +		}
  1.1975 +	}
  1.1976 +
  1.1977 +
  1.1978 +void RA3FDevSoundToneSetToneRepetitionsNotPlayingTonesModeTest::ToneFinished(TInt aError)
  1.1979 +	{
  1.1980 +	INFO_PRINTF1(_L("========== DevSound ToneFinished() callback =========="));
  1.1981 +	if (aError == KErrUnderflow)
  1.1982 +		{
  1.1983 +		iEndTime.HomeTime();
  1.1984 +		iPlayToneTime = iEndTime.MicroSecondsFrom(iStartTime);
  1.1985 +		TInt repeatTrailingSilenceToSecs = iRepeatTrailingSilence/KMicroSecsInOneSec;
  1.1986 +		TInt totalExpectedReproductionTime = (iDuration + iRepeatCount * iDuration+ (repeatTrailingSilenceToSecs*iRepeatCount)) * KMicroSecsInOneSec;
  1.1987 +		if(iPlayToneTime < (totalExpectedReproductionTime + KPlayVarianceTime) && iPlayToneTime > (totalExpectedReproductionTime - KPlayVarianceTime))
  1.1988 +			{
  1.1989 +			INFO_PRINTF1(_L("Play tone repeats succeded."));
  1.1990 +			INFO_PRINTF2(_L("Play time is %Ld microseconds"), iPlayToneTime.Int64());
  1.1991 +			StopTest();
  1.1992 +			}
  1.1993 +		else
  1.1994 +			{
  1.1995 +			ERR_PRINTF1(_L("Play tone repeats did not work as planned."));
  1.1996 +			ERR_PRINTF3(_L("Play time is %Ld microseconds and it should have been %d microseconds"), iPlayToneTime.Int64(), totalExpectedReproductionTime);
  1.1997 +			StopTest(KErrNone, EFail);
  1.1998 +			}
  1.1999 +		}
  1.2000 +	else
  1.2001 +		{
  1.2002 +		ERR_PRINTF2(_L("DevSound called ToneFinished with error = %d"), aError);
  1.2003 +		ERR_PRINTF2(_L("Expected error = %d"), KErrUnderflow);
  1.2004 +		StopTest(aError, EFail);
  1.2005 +		}
  1.2006 +	}
  1.2007 +
  1.2008 +/*
  1.2009 + *========================================================================================================
  1.2010 + * MM-A3F-DEVSOUND-CHRTZ-TONE-0015
  1.2011 + */
  1.2012 +RA3FDevSoundToneSetDTMFLengthsNotPlayingTonesModeTest::RA3FDevSoundToneSetDTMFLengthsNotPlayingTonesModeTest(const TDesC& aTestName)
  1.2013 +	:	RA3FDevSoundTestBase(aTestName), iInitializedToPlayTones(EFalse),
  1.2014 +		iDTMFString(KNullDesC), iToneOnLength(0),
  1.2015 +		iToneOffLength(0), iPauseLength(0),
  1.2016 +		iDTMFPauses(0), iDTMFTones(0)
  1.2017 +
  1.2018 +	{
  1.2019 +	}
  1.2020 +
  1.2021 +RA3FDevSoundToneSetDTMFLengthsNotPlayingTonesModeTest* RA3FDevSoundToneSetDTMFLengthsNotPlayingTonesModeTest::NewL(const TDesC& aTestName)
  1.2022 +	{
  1.2023 +	RA3FDevSoundToneSetDTMFLengthsNotPlayingTonesModeTest * self = new(ELeave)RA3FDevSoundToneSetDTMFLengthsNotPlayingTonesModeTest(aTestName);
  1.2024 +	return self;
  1.2025 +	}
  1.2026 +
  1.2027 +void RA3FDevSoundToneSetDTMFLengthsNotPlayingTonesModeTest::DoKickoffTestL()
  1.2028 +	{
  1.2029 +	if (!GetIntFromConfig(iTestStepName, KToneOnLength, iToneOnLength))
  1.2030 +		{
  1.2031 +		ERR_PRINTF2(KMsgErrorGetParameter, &KToneOnLength);
  1.2032 +		StopTest(KErrNotFound);
  1.2033 +		return;
  1.2034 +		}
  1.2035 +	if (!GetIntFromConfig(iTestStepName, KToneOffLength, iToneOffLength))
  1.2036 +		{
  1.2037 +		ERR_PRINTF2(KMsgErrorGetParameter, &KToneOffLength);
  1.2038 +		StopTest(KErrNotFound);
  1.2039 +		return;
  1.2040 +		}
  1.2041 +	if (!GetIntFromConfig(iTestStepName, KPauseLength, iPauseLength))
  1.2042 +		{
  1.2043 +		ERR_PRINTF2(KMsgErrorGetParameter, &KPauseLength);
  1.2044 +		StopTest(KErrNotFound);
  1.2045 +		return;
  1.2046 +		}
  1.2047 +	TPtrC DTMF;
  1.2048 +	if (!GetStringFromConfig(iTestStepName, KDTMFString, DTMF))
  1.2049 +		{
  1.2050 +		ERR_PRINTF2(KMsgErrorGetParameter, &KDTMFString);
  1.2051 +		StopTest(KErrNotFound);
  1.2052 +		return;
  1.2053 +		}
  1.2054 +	iDTMFString.Copy(DTMF);
  1.2055 +	for(TInt i =0 ; i< iDTMFString.Length() ; i++)
  1.2056 +		{
  1.2057 +		if (iDTMFString[i] == ',')
  1.2058 +			{
  1.2059 +			iDTMFPauses++;
  1.2060 +			}
  1.2061 +		else
  1.2062 +			{
  1.2063 +			iDTMFTones++;
  1.2064 +			}
  1.2065 +		}
  1.2066 +	}
  1.2067 +
  1.2068 +void RA3FDevSoundToneSetDTMFLengthsNotPlayingTonesModeTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError)
  1.2069 +	{
  1.2070 +	switch (iDevSoundState)
  1.2071 +		{
  1.2072 +		case EStateCreated:
  1.2073 +			{
  1.2074 +			__ASSERT_ALWAYS((aError == KErrNone), Panic(_L("RA3FDevSoundToneSetDTMFLengthsNotPlayingTonesModeConfigurationTest"), EFsmIncorrectErrorPassed));
  1.2075 +			if(aDevSoundEvent == EEventInitialize)
  1.2076 +				{
  1.2077 +				INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL"));
  1.2078 +				TRAPD(err, iMMFDevSound->InitializeL(*this, EMMFStateRecording));
  1.2079 +				if (err != KErrNone)
  1.2080 +					{
  1.2081 +					ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err);
  1.2082 +					StopTest(err);
  1.2083 +					break;
  1.2084 +					}
  1.2085 +				INFO_PRINTF1(_L("DevSound State: EStateInitializing"));
  1.2086 +				iDevSoundState = EStateInitializing;
  1.2087 +				}
  1.2088 +			else
  1.2089 +				{
  1.2090 +				ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"),  aDevSoundEvent);
  1.2091 +				StopTest(aError, EFail);
  1.2092 +				}
  1.2093 +			break;
  1.2094 +			}
  1.2095 +		case EStateInitializing:
  1.2096 +			{
  1.2097 +			if (aDevSoundEvent == EEventInitComplete && aError == KErrNone)
  1.2098 +				{
  1.2099 +				if(!iInitializedToPlayTones)
  1.2100 +					{
  1.2101 +					TTimeIntervalMicroSeconds32 ToneOnLength(iToneOnLength);
  1.2102 +					TTimeIntervalMicroSeconds32 ToneOffLength(iToneOffLength);
  1.2103 +					TTimeIntervalMicroSeconds32 PauseLength(iPauseLength);
  1.2104 +					INFO_PRINTF4(_L("Calling CMMFDevSound::SetDTMFLengths. ToneOnLength = %d, ToneOffLength = %d and PauseLength = %d"), ToneOnLength.Int(), ToneOffLength.Int(), PauseLength.Int());
  1.2105 +					iMMFDevSound->SetDTMFLengths(ToneOnLength, ToneOffLength, PauseLength);
  1.2106 +					INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL"));
  1.2107 +					TRAPD(err, iMMFDevSound->InitializeL(*this, EMMFStateTonePlaying));
  1.2108 +					if (err != KErrNone)
  1.2109 +						{
  1.2110 +						ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err);
  1.2111 +						StopTest(err);
  1.2112 +						break;
  1.2113 +						}
  1.2114 +					iInitializedToPlayTones = ETrue;
  1.2115 +					}
  1.2116 +				else
  1.2117 +					{
  1.2118 +					iMMFDevSound->SetVolume(iMMFDevSound->MaxVolume());
  1.2119 +					iStartTime.HomeTime();
  1.2120 +					INFO_PRINTF2(_L("Calling CMMFDevSound::PlayDTMFStringL %S"), &iDTMFString);
  1.2121 +					TRAPD(err, iMMFDevSound->PlayDTMFStringL(iDTMFString));
  1.2122 +					if (err != KErrNone)
  1.2123 +						{
  1.2124 +						ERR_PRINTF2(_L("Play DTMF string failed with error : %d!"), err);
  1.2125 +						StopTest(err);
  1.2126 +						break;
  1.2127 +						}
  1.2128 +					INFO_PRINTF1(_L("DevSound State: EStatePlaying"));
  1.2129 +					iDevSoundState = EStatePlaying;
  1.2130 +					}
  1.2131 +				}
  1.2132 +			else if (aDevSoundEvent == EEventInitComplete && aError != KErrNone)
  1.2133 +				{
  1.2134 +				ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error = %d"), aError);
  1.2135 +				StopTest(aError);
  1.2136 +				}
  1.2137 +			else
  1.2138 +				{
  1.2139 +				ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent);
  1.2140 +				StopTest(aError, EFail);
  1.2141 +				}
  1.2142 +			break;
  1.2143 +			}
  1.2144 +		default:
  1.2145 +			{
  1.2146 +			ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState);
  1.2147 +			StopTest(aError, EFail);
  1.2148 +			}
  1.2149 +		}
  1.2150 +	}
  1.2151 +
  1.2152 +void RA3FDevSoundToneSetDTMFLengthsNotPlayingTonesModeTest::ToneFinished(TInt aError)
  1.2153 +	{
  1.2154 +	INFO_PRINTF1(_L("========== DevSound ToneFinished() callback =========="));
  1.2155 +	if (aError == KErrUnderflow)
  1.2156 +		{
  1.2157 +		iEndTime.HomeTime();
  1.2158 +		iPlayToneTime = iEndTime.MicroSecondsFrom(iStartTime);
  1.2159 +		TInt totalExpectedReproductionTime = iToneOnLength*iDTMFTones + iToneOffLength * iDTMFTones + iDTMFPauses * iPauseLength;
  1.2160 +		if (iPlayToneTime.Int64() < totalExpectedReproductionTime + KPlayVarianceTime && iPlayToneTime.Int64() > totalExpectedReproductionTime - KPlayVarianceTime)
  1.2161 +			{
  1.2162 +			INFO_PRINTF1(_L("CMMFDevSound::SetDTMFLengths settings were remembered after re-initialization."));
  1.2163 +			INFO_PRINTF2(_L("Play time is %Ld microseconds"), iPlayToneTime.Int64());
  1.2164 +			StopTest();
  1.2165 +			}
  1.2166 +		else
  1.2167 +			{
  1.2168 +			ERR_PRINTF1(_L("CMMFDevSound::SetDTMFLengths settings were not remembered after re-initialization."));
  1.2169 +			ERR_PRINTF2(_L("Expected time %d"), totalExpectedReproductionTime);
  1.2170 +			StopTest(KErrNone, EFail);
  1.2171 +			}
  1.2172 +		}
  1.2173 +	else
  1.2174 +		{
  1.2175 +		ERR_PRINTF2(_L("DevSound called ToneFinished with error = %d"), aError);
  1.2176 +		ERR_PRINTF2(_L("Expected error = %d"), KErrUnderflow);
  1.2177 +		StopTest(aError, EFail);
  1.2178 +		}
  1.2179 +	}
  1.2180 +
  1.2181 +/*
  1.2182 + *========================================================================================================
  1.2183 + * MM-A3F-DEVSOUND-CHRTZ-TONE-0016
  1.2184 + */
  1.2185 +RA3FDevSoundToneSetConfigWhilePlayingTest::RA3FDevSoundToneSetConfigWhilePlayingTest(const TDesC& aTestName)
  1.2186 +	:	RA3FDevSoundTestBase(aTestName), iDuration(0),
  1.2187 +		iVolume(0), iFrequencyTone1(0),
  1.2188 +		iSampleRate(0), iChannels(0)
  1.2189 +	{
  1.2190 +	}
  1.2191 +
  1.2192 +RA3FDevSoundToneSetConfigWhilePlayingTest* RA3FDevSoundToneSetConfigWhilePlayingTest::NewL(const TDesC& aTestName)
  1.2193 +	{
  1.2194 +	RA3FDevSoundToneSetConfigWhilePlayingTest * self = new(ELeave)RA3FDevSoundToneSetConfigWhilePlayingTest(aTestName);
  1.2195 +	return self;
  1.2196 +	}
  1.2197 +
  1.2198 +void RA3FDevSoundToneSetConfigWhilePlayingTest::DoKickoffTestL()
  1.2199 +	{
  1.2200 +	if (!GetIntFromConfig(iTestStepName, KSampleRate, iSampleRate))
  1.2201 +		{
  1.2202 +		ERR_PRINTF2(KMsgErrorGetParameter, &KSampleRate);
  1.2203 +		StopTest(KErrNotFound);
  1.2204 +		return;
  1.2205 +		}
  1.2206 +	if (!GetIntFromConfig(iTestStepName, KChannel, iChannels))
  1.2207 +		{
  1.2208 +		ERR_PRINTF2(KMsgErrorGetParameter, &KChannel);
  1.2209 +		StopTest(KErrNotFound);
  1.2210 +		return;
  1.2211 +		}
  1.2212 +	if (!GetIntFromConfig(iTestStepName, KDuration, iDuration))
  1.2213 +		{
  1.2214 +		ERR_PRINTF2(KMsgErrorGetParameter, &KDuration);
  1.2215 +		StopTest(KErrNotFound);
  1.2216 +		return;
  1.2217 +		}
  1.2218 +	if (!GetIntFromConfig(iTestStepName, KFrequencyTone1, iFrequencyTone1))
  1.2219 +		{
  1.2220 +		ERR_PRINTF2(KMsgErrorGetParameter, &KFrequencyTone1);
  1.2221 +		StopTest(KErrNotFound);
  1.2222 +		return;
  1.2223 +		}
  1.2224 +	iTimer = CPeriodic::NewL(CActive::EPriorityHigh);
  1.2225 +	}
  1.2226 +
  1.2227 +void RA3FDevSoundToneSetConfigWhilePlayingTest::Fsm(TMmfDevSoundEvent aDevSoundEvent,  TInt aError)
  1.2228 +	{
  1.2229 +	switch (iDevSoundState)
  1.2230 +		{
  1.2231 +		case EStateCreated:
  1.2232 +			{
  1.2233 +			__ASSERT_ALWAYS((aError == KErrNone), Panic(_L("RA3FDevSoundToneSetConfigWhilePlayingTest"), EFsmIncorrectErrorPassed));
  1.2234 +			if (aDevSoundEvent == EEventInitialize)
  1.2235 +				{
  1.2236 +				INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL"));
  1.2237 +				TRAPD(err, iMMFDevSound->InitializeL(*this, EMMFStateTonePlaying));
  1.2238 +				if (err != KErrNone)
  1.2239 +					{
  1.2240 +					ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err);
  1.2241 +					StopTest(err);
  1.2242 +					break;
  1.2243 +					}
  1.2244 +				StartTimer(KMicroSecsTwoSec);
  1.2245 +				INFO_PRINTF1(_L("DevSound State: EStateInitializing"));
  1.2246 +				iDevSoundState = EStateInitializing;
  1.2247 +				}
  1.2248 +			else
  1.2249 +				{
  1.2250 +				ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent);
  1.2251 +				StopTest(aError, EFail);
  1.2252 +				}
  1.2253 +			break;
  1.2254 +			}
  1.2255 +		case EStateInitializing:
  1.2256 +			{
  1.2257 +			if (aDevSoundEvent == EEventInitComplete && aError == KErrNone)
  1.2258 +				{
  1.2259 +				INFO_PRINTF1(_L("CMMFDevSound::PlayToneL"));
  1.2260 +				TRAPD(err, iMMFDevSound->PlayToneL(iFrequencyTone1,  iDuration*KMicroSecsInOneSec));
  1.2261 +				if (err != KErrNone)
  1.2262 +					{
  1.2263 +					ERR_PRINTF2(_L("CMMFDevSound::PlayToneL left with error : %d"), err);
  1.2264 +					StopTest(err);
  1.2265 +					break;
  1.2266 +					}
  1.2267 +				INFO_PRINTF1(_L("DevSound State: EStatePlaying"));
  1.2268 +				iDevSoundState = EStatePlaying;
  1.2269 +				}
  1.2270 +			else if (aDevSoundEvent == EEventInitComplete && aError != KErrNone)
  1.2271 +				{
  1.2272 +				ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error = %d"), aError);
  1.2273 +				StopTest(aError);
  1.2274 +				}
  1.2275 +			else
  1.2276 +				{
  1.2277 +				ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent);
  1.2278 +				StopTest(aError, EFail);
  1.2279 +				}
  1.2280 +			break;
  1.2281 +			}
  1.2282 +		default:
  1.2283 +			{
  1.2284 +			ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState);
  1.2285 +			StopTest(aError, EFail);
  1.2286 +			}
  1.2287 +		}
  1.2288 +	}
  1.2289 +
  1.2290 +void RA3FDevSoundToneSetConfigWhilePlayingTest::DoTimerCallback()
  1.2291 +	{
  1.2292 +	iTimer->Cancel();
  1.2293 +	INFO_PRINTF1(_L("DevSound Event: EEventTimerComplete"));
  1.2294 +	TMMFCapabilities capabilitiesSet;
  1.2295 +	TBuf<KMaxSampleRateStringLength> stringSampleRateSet;
  1.2296 +	TBuf<KMaxChannelsStringLength> stringChannelsSet;
  1.2297 +	TMMFSampleRate eSampleRate;
  1.2298 +	SampleRateFromTIntToTMMFSampleRate (iSampleRate, eSampleRate);
  1.2299 +	capabilitiesSet.iRate = eSampleRate;
  1.2300 +	capabilitiesSet.iChannels = iChannels;
  1.2301 +	SampleRateFromTUintToString (capabilitiesSet.iRate,	stringSampleRateSet);
  1.2302 +	ChannelsFromTUintToString (capabilitiesSet.iChannels, stringChannelsSet);
  1.2303 +	INFO_PRINTF3(_L("Calling CMMFDevSound::SetConfigL using sample rate = %S and channel mode = %S"), &stringSampleRateSet, &stringChannelsSet);
  1.2304 +	TRAPD(err, iMMFDevSound->SetConfigL(capabilitiesSet));
  1.2305 +	if (err == KErrNotReady)
  1.2306 +		{
  1.2307 +		INFO_PRINTF2(_L("CMMFDevSound::SetConfigL succeeded with error = %d"), err);
  1.2308 +		StopTest(err, EPass);
  1.2309 +		}
  1.2310 +	else
  1.2311 +		{
  1.2312 +		ERR_PRINTF2(_L("CMMFDevSound::SetConfigL failed with error = %d"), err);
  1.2313 +		ERR_PRINTF2(_L("Expected  error = %d"), KErrNotReady);
  1.2314 +		StopTest(err, EFail);
  1.2315 +		}
  1.2316 +	}
  1.2317 +
  1.2318 +/*
  1.2319 + *========================================================================================================
  1.2320 + * MM-A3F-DEVSOUND-CHRTZ-TONE-0017
  1.2321 + */
  1.2322 +RA3FDevSoundToneSetPriorityWhilePlayingTest::RA3FDevSoundToneSetPriorityWhilePlayingTest(const TDesC& aTestName)
  1.2323 +	:	RA3FDevSoundTestBase(aTestName),
  1.2324 +		iDuration(0), iFrequencyTone1(0)
  1.2325 +	{
  1.2326 +	}
  1.2327 +
  1.2328 +RA3FDevSoundToneSetPriorityWhilePlayingTest* RA3FDevSoundToneSetPriorityWhilePlayingTest::NewL(const TDesC& aTestName)
  1.2329 +	{
  1.2330 +	RA3FDevSoundToneSetPriorityWhilePlayingTest * self = new(ELeave)RA3FDevSoundToneSetPriorityWhilePlayingTest(aTestName);
  1.2331 +	return self;
  1.2332 +	}
  1.2333 +
  1.2334 +void RA3FDevSoundToneSetPriorityWhilePlayingTest::DoKickoffTestL()
  1.2335 +	{
  1.2336 +	if (!GetIntFromConfig(iTestStepName, KDuration, iDuration))
  1.2337 +		{
  1.2338 +		ERR_PRINTF2(KMsgErrorGetParameter, &KDuration);
  1.2339 +		StopTest(KErrNotFound);
  1.2340 +		return;
  1.2341 +		}
  1.2342 +	if (!GetIntFromConfig(iTestStepName, KFrequencyTone1, iFrequencyTone1))
  1.2343 +		{
  1.2344 +		ERR_PRINTF2(KMsgErrorGetParameter, &KFrequencyTone1);
  1.2345 +		StopTest(KErrNotFound);
  1.2346 +		return;
  1.2347 +		}
  1.2348 +	iTimer = CPeriodic::NewL(CActive::EPriorityHigh);
  1.2349 +	iDevsoundToneClient = CA3FDevSoundToneClient::NewL(*this);
  1.2350 +	}
  1.2351 +
  1.2352 +void RA3FDevSoundToneSetPriorityWhilePlayingTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError)
  1.2353 +	{
  1.2354 +	switch(iDevSoundState)
  1.2355 +		{
  1.2356 +		case EStateCreated:
  1.2357 +			{
  1.2358 +			__ASSERT_ALWAYS((aError == KErrNone), Panic(_L("RA3FDevSoundToneSetPriorityWhilePlayingConfigurationTest"), EFsmIncorrectErrorPassed));
  1.2359 +			if(aDevSoundEvent == EEventInitialize)
  1.2360 +				{
  1.2361 +				INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL"));
  1.2362 +				TRAPD(err, iMMFDevSound->InitializeL(*this, EMMFStateTonePlaying));
  1.2363 +				if (err != KErrNone)
  1.2364 +					{
  1.2365 +					ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err);
  1.2366 +					StopTest(err);
  1.2367 +					break;
  1.2368 +					}
  1.2369 +				INFO_PRINTF1(_L("DevSound State: EStateInitializing"));
  1.2370 +				iDevSoundState = EStateInitializing;
  1.2371 +				}
  1.2372 +			else
  1.2373 +				{
  1.2374 +				ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent);
  1.2375 +				StopTest(aError, EFail);
  1.2376 +				}
  1.2377 +			break;
  1.2378 +			}
  1.2379 +		case EStateInitializing:
  1.2380 +			{
  1.2381 +			if (aDevSoundEvent == EEventInitComplete && aError == KErrNone)
  1.2382 +				{
  1.2383 +				iMMFDevSound->SetVolume(iMMFDevSound->MaxVolume ());
  1.2384 +				INFO_PRINTF1(_L("Calling CMMFDevSound::PlayToneL"));
  1.2385 +				TRAPD(err, iMMFDevSound->PlayToneL(iFrequencyTone1, iDuration*KMicroSecsInOneSec));
  1.2386 +				if (err != KErrNone)
  1.2387 +					{
  1.2388 +					ERR_PRINTF2(_L("CMMFDevSound::PlayToneL left with error : %d!"), err);
  1.2389 +					StopTest(err);
  1.2390 +					break;
  1.2391 +					}
  1.2392 +				StartTimer(KMicroSecsTwoSec);
  1.2393 +				INFO_PRINTF1(_L("DevSound State: EStatePlaying"));
  1.2394 +				iDevSoundState = EStatePlaying;
  1.2395 +				INFO_PRINTF2(_L("Calling CMMFDevSound::SetPrioritySettings using a priority(highest) value = %d"), KMaximumPriority);
  1.2396 +				TMMFPrioritySettings priority;
  1.2397 +				priority.iPriority = KMaximumPriority;
  1.2398 +				iMMFDevSound->SetPrioritySettings(priority);
  1.2399 +				}
  1.2400 +			else if (aDevSoundEvent == EEventInitComplete && aError != KErrNone)
  1.2401 +				{
  1.2402 +				ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error = %d"), aError);
  1.2403 +				StopTest(aError);
  1.2404 +				}
  1.2405 +			else
  1.2406 +				{
  1.2407 +				ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent);
  1.2408 +				StopTest(aError,  EFail);
  1.2409 +				}
  1.2410 +			break;
  1.2411 +			}
  1.2412 +		default:
  1.2413 +			{
  1.2414 +			ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState);
  1.2415 +			StopTest(aError, EFail);
  1.2416 +			}
  1.2417 +		}
  1.2418 +	}
  1.2419 +
  1.2420 +void RA3FDevSoundToneSetPriorityWhilePlayingTest::ClientInitializeCompleteCallback(TInt aError)
  1.2421 +	{
  1.2422 +	INFO_PRINTF1(_L("==========Second DevSound client called InitializeComplete()=========="));
  1.2423 +	if (aError == KErrNone)
  1.2424 +		{
  1.2425 +		TInt err = iDevsoundToneClient->PlayTone ();
  1.2426 +		if (err != KErrNone)
  1.2427 +			{
  1.2428 +			ERR_PRINTF2(_L("Second Devsound client called PlayTone and failed with error = %d"), err);
  1.2429 +			StopTest(err);
  1.2430 +			}
  1.2431 +		}
  1.2432 +	else
  1.2433 +		{
  1.2434 +		ERR_PRINTF2(_L("Second Devsound InitializeComplete received an error = %d"), aError);
  1.2435 +		StopTest(aError);
  1.2436 +		}
  1.2437 +	}
  1.2438 +
  1.2439 +void RA3FDevSoundToneSetPriorityWhilePlayingTest::ClientToneFinishedCallback(TInt aError)
  1.2440 +	{
  1.2441 +	INFO_PRINTF1(_L("========== Second  DevSound client called ToneFinished()=========="));
  1.2442 +	if (aError == KErrUnderflow)
  1.2443 +		{
  1.2444 +		INFO_PRINTF2(_L("Second DevSound client called ToneFinished and succeeded with error = %d"), aError);
  1.2445 +		StopTest(aError, EPass);
  1.2446 +		}
  1.2447 +	else
  1.2448 +		{
  1.2449 +		ERR_PRINTF2(_L("Second DevSound client called ToneFinished and failed with error = %d"), aError);
  1.2450 +		StopTest(aError, EFail);
  1.2451 +		}
  1.2452 +	}
  1.2453 +
  1.2454 +void RA3FDevSoundToneSetPriorityWhilePlayingTest::DoTimerCallback()
  1.2455 +	{
  1.2456 +	INFO_PRINTF1(_L("TimerEvent called"));
  1.2457 +	iTimer->Cancel();
  1.2458 +	INFO_PRINTF1(_L("Starting another devsound client using the highest priority"));
  1.2459 +	iDevsoundToneClient->SetPriority(KMaximumPriority);
  1.2460 +	TInt err = iDevsoundToneClient->InitTonePlay(iFrequencyTone1, iDuration*KMicroSecsInOneSec);
  1.2461 +	if(err != KErrNone)
  1.2462 +		{
  1.2463 +		ERR_PRINTF1(_L("Initialization to play tone thru second devsound client failed"));
  1.2464 +		StopTest(err);
  1.2465 +		}
  1.2466 +	}
  1.2467 +
  1.2468 +void RA3FDevSoundToneSetPriorityWhilePlayingTest::ToneFinished(TInt aError)
  1.2469 +	{
  1.2470 +	INFO_PRINTF1(_L("========== DevSound ToneFinished() callback =========="));
  1.2471 +	if (aError == KErrInUse || aError == KErrDied || aError == KErrAccessDenied)
  1.2472 +		{
  1.2473 +		INFO_PRINTF1(_L("========== Preempting 1st DevSound Instance=========="));
  1.2474 +		}
  1.2475 +	else
  1.2476 +		{
  1.2477 +		ERR_PRINTF2(_L("DevSound called ToneFinished and failed with error = %d"), aError);
  1.2478 +		ERR_PRINTF4(_L("Expected errors posibilities %d %d %d"), KErrInUse, KErrDied, KErrAccessDenied);
  1.2479 +		StopTest(aError, EFail);
  1.2480 +		}
  1.2481 +	}
  1.2482 +
  1.2483 +/*
  1.2484 + *========================================================================================================
  1.2485 + * MM-A3F-DEVSOUND-CHRTZ-TONE-0018
  1.2486 + */
  1.2487 +RA3FDevSoundToneSetConfigTestToInvalidSampleRateValue::RA3FDevSoundToneSetConfigTestToInvalidSampleRateValue(const TDesC& aTestName)
  1.2488 +	:	RA3FDevSoundTestBase(aTestName), iSampleRate(0),
  1.2489 +		iChannels(0)
  1.2490 +	{
  1.2491 +	}
  1.2492 +
  1.2493 +RA3FDevSoundToneSetConfigTestToInvalidSampleRateValue* RA3FDevSoundToneSetConfigTestToInvalidSampleRateValue::NewL(const TDesC& aTestName)
  1.2494 +	{
  1.2495 +	RA3FDevSoundToneSetConfigTestToInvalidSampleRateValue * self = new(ELeave)RA3FDevSoundToneSetConfigTestToInvalidSampleRateValue(aTestName);
  1.2496 +	return self;
  1.2497 +	}
  1.2498 +
  1.2499 +void RA3FDevSoundToneSetConfigTestToInvalidSampleRateValue::DoKickoffTestL()
  1.2500 +	{
  1.2501 +	if (!GetIntFromConfig(iTestStepName, KSampleRate, iSampleRate))
  1.2502 +		{
  1.2503 +		ERR_PRINTF2(KMsgErrorGetParameter, &KSampleRate);
  1.2504 +		StopTest(KErrNotFound);
  1.2505 +		return;
  1.2506 +		}
  1.2507 +	if (!GetIntFromConfig(iTestStepName, KChannel, iChannels))
  1.2508 +		{
  1.2509 +		ERR_PRINTF2(KMsgErrorGetParameter, &KChannel);
  1.2510 +		StopTest(KErrNotFound);
  1.2511 +		return;
  1.2512 +		}
  1.2513 +	}
  1.2514 +
  1.2515 +void RA3FDevSoundToneSetConfigTestToInvalidSampleRateValue::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError)
  1.2516 +	{
  1.2517 +#ifdef MM_TB101_L
  1.2518 +		//Reason: Check remains since this is a valid test case, but we need to know why we are not testing invalid rates.
  1.2519 +		INFO_PRINTF1(_L("MM_TB101_L defined: All sample rates are valid for MM_TB101_L (HW), therefore no invalid rates can be tested."));
  1.2520 +		StopTest(KErrNotSupported, EPass);
  1.2521 +#else
  1.2522 +	switch(iDevSoundState)
  1.2523 +		{
  1.2524 +		case EStateCreated:
  1.2525 +			{
  1.2526 +			if(aDevSoundEvent == EEventInitialize)
  1.2527 +				{
  1.2528 +				__ASSERT_ALWAYS((aError == KErrNone), Panic(_L("RA3FDevSoundToneSetConfigTestToInvalidSampleRateValue"), EFsmIncorrectErrorPassed));
  1.2529 +				INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL"));
  1.2530 +				TRAPD(err, iMMFDevSound->InitializeL(*this, EMMFStateTonePlaying));
  1.2531 +				if (err != KErrNone)
  1.2532 +					{
  1.2533 +					ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err);
  1.2534 +					StopTest(err);
  1.2535 +					break;
  1.2536 +					}
  1.2537 +				INFO_PRINTF1(_L("DevSound State: EStateInitializing"));
  1.2538 +				iDevSoundState = EStateInitializing;
  1.2539 +				}
  1.2540 +			else
  1.2541 +				{
  1.2542 +				ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent);
  1.2543 +				StopTest(aError, EFail);
  1.2544 +				}
  1.2545 +			break;
  1.2546 +			}
  1.2547 +		case EStateInitializing:
  1.2548 +			{
  1.2549 +			if (aDevSoundEvent == EEventInitComplete && aError == KErrNone)
  1.2550 +				{
  1.2551 +				TMMFCapabilities capabilitiesSet;
  1.2552 +				TBuf<KMaxSampleRateStringLength> stringSampleRateSet;
  1.2553 +				TBuf<KMaxChannelsStringLength> stringChannelsSet;
  1.2554 +				TMMFSampleRate eSampleRate;
  1.2555 +				SampleRateFromTIntToTMMFSampleRate (iSampleRate, eSampleRate);
  1.2556 +				capabilitiesSet.iRate = eSampleRate;
  1.2557 +				capabilitiesSet.iChannels = iChannels;
  1.2558 +				SampleRateFromTUintToString (capabilitiesSet.iRate,	stringSampleRateSet);
  1.2559 +				ChannelsFromTUintToString (capabilitiesSet.iChannels, stringChannelsSet);
  1.2560 +				INFO_PRINTF3(_L("Calling CMMFDevSound::SetConfigL using an invalid sample rate = %S and channel mode = %S"), &stringSampleRateSet, &stringChannelsSet);
  1.2561 +				TRAPD(err, iMMFDevSound->SetConfigL(capabilitiesSet));
  1.2562 +				if (err == KErrNotSupported || err == KErrArgument)
  1.2563 +					{
  1.2564 +					INFO_PRINTF2(_L("CMMFDevSound::SetConfigL succeeded with error = %d"), err);
  1.2565 +					StopTest(err, EPass);
  1.2566 +					}
  1.2567 +				else
  1.2568 +					{
  1.2569 +					ERR_PRINTF2(_L("CMMFDevSound::SetConfigL failed with error = %d"), err);
  1.2570 +					ERR_PRINTF3(_L("Expected  error posibilities %d %d"), KErrArgument, KErrNotSupported);
  1.2571 +					StopTest(err, EFail);
  1.2572 +					}
  1.2573 +				}
  1.2574 +			else if (aDevSoundEvent == EEventInitComplete && aError != KErrNone)
  1.2575 +				{
  1.2576 +				ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error = %d"), aError);
  1.2577 +				StopTest(aError);
  1.2578 +				}
  1.2579 +			else
  1.2580 +				{
  1.2581 +				ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent);
  1.2582 +				StopTest(aError, EFail);
  1.2583 +				}
  1.2584 +			break;
  1.2585 +			}
  1.2586 +		default:
  1.2587 +			{
  1.2588 +			ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState);
  1.2589 +			StopTest(aError, EFail);
  1.2590 +			}
  1.2591 +		}
  1.2592 +#endif// MM_TB101_L
  1.2593 +	}
  1.2594 +
  1.2595 +/*
  1.2596 + *========================================================================================================
  1.2597 + * MM-A3F-DEVSOUND-CHRTZ-TONE-0019
  1.2598 + */
  1.2599 +RA3FDevSoundToneSetConfigTestToInvalidChannelValueTest::RA3FDevSoundToneSetConfigTestToInvalidChannelValueTest(const TDesC& aTestName)
  1.2600 +	:	RA3FDevSoundTestBase(aTestName), iSampleRate(0),
  1.2601 +		iChannels(0)
  1.2602 +	{
  1.2603 +	}
  1.2604 +
  1.2605 +RA3FDevSoundToneSetConfigTestToInvalidChannelValueTest* RA3FDevSoundToneSetConfigTestToInvalidChannelValueTest::NewL(const TDesC& aTestName)
  1.2606 +	{
  1.2607 +	RA3FDevSoundToneSetConfigTestToInvalidChannelValueTest * self = new(ELeave)RA3FDevSoundToneSetConfigTestToInvalidChannelValueTest(aTestName);
  1.2608 +	return self;
  1.2609 +	}
  1.2610 +
  1.2611 +void RA3FDevSoundToneSetConfigTestToInvalidChannelValueTest::DoKickoffTestL()
  1.2612 +	{
  1.2613 +	if (!GetIntFromConfig(iTestStepName, KSampleRate, iSampleRate))
  1.2614 +		{
  1.2615 +		ERR_PRINTF2(KMsgErrorGetParameter, &KSampleRate);
  1.2616 +		StopTest(KErrNotFound);
  1.2617 +		return;
  1.2618 +		}
  1.2619 +	if (!GetIntFromConfig(iTestStepName, KChannel, iChannels))
  1.2620 +		{
  1.2621 +		ERR_PRINTF2(KMsgErrorGetParameter, &KChannel);
  1.2622 +		StopTest(KErrNotFound);
  1.2623 +		return;
  1.2624 +		}
  1.2625 +	}
  1.2626 +
  1.2627 +void RA3FDevSoundToneSetConfigTestToInvalidChannelValueTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError)
  1.2628 +	{
  1.2629 +	switch(iDevSoundState)
  1.2630 +		{
  1.2631 +		case EStateCreated:
  1.2632 +			{
  1.2633 +			if(aDevSoundEvent == EEventInitialize)
  1.2634 +				{
  1.2635 +				__ASSERT_ALWAYS((aError == KErrNone), Panic(_L("RA3FDevSoundToneSetConfigTestToInvalidChannelValueTest"), EFsmIncorrectErrorPassed));
  1.2636 +				INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL"));
  1.2637 +				TRAPD(err, iMMFDevSound->InitializeL(*this, EMMFStateTonePlaying));
  1.2638 +				if (err != KErrNone)
  1.2639 +					{
  1.2640 +					ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err);
  1.2641 +					StopTest(err);
  1.2642 +					break;
  1.2643 +					}
  1.2644 +				INFO_PRINTF1(_L("DevSound State: EStateInitializing"));
  1.2645 +				iDevSoundState = EStateInitializing;
  1.2646 +				}
  1.2647 +			else
  1.2648 +				{
  1.2649 +				ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent);
  1.2650 +				StopTest(aError, EFail);
  1.2651 +				}
  1.2652 +			break;
  1.2653 +			}
  1.2654 +		case EStateInitializing:
  1.2655 +			{
  1.2656 +			if (aDevSoundEvent == EEventInitComplete && aError == KErrNone)
  1.2657 +				{
  1.2658 +				TMMFCapabilities capabilitiesSet;
  1.2659 +				TBuf<KMaxSampleRateStringLength> stringSampleRateSet;
  1.2660 +				TBuf<KMaxChannelsStringLength> stringChannelsSet;
  1.2661 +				TMMFSampleRate eSampleRate;
  1.2662 +				SampleRateFromTIntToTMMFSampleRate (iSampleRate, eSampleRate);
  1.2663 +				capabilitiesSet.iRate = eSampleRate;
  1.2664 +				capabilitiesSet.iChannels = iChannels;
  1.2665 +				SampleRateFromTUintToString (capabilitiesSet.iRate,	stringSampleRateSet);
  1.2666 +				INFO_PRINTF3(_L("Calling CMMFDevSound::SetConfigL using a sample rate = %S and an invalid channel mode = %d"), &stringSampleRateSet, iChannels);
  1.2667 +				TRAPD(err, iMMFDevSound->SetConfigL(capabilitiesSet));
  1.2668 +				if (err == KErrNotSupported || err == KErrArgument)
  1.2669 +					{
  1.2670 +					INFO_PRINTF2(_L("CMMFDevSound::SetConfigL succeeded with error = %d"), err);
  1.2671 +					StopTest(err, EPass);
  1.2672 +					}
  1.2673 +				else
  1.2674 +					{
  1.2675 +					ERR_PRINTF2(_L("CMMFDevSound::SetConfigL failed with error = %d"), err);
  1.2676 +					ERR_PRINTF3(_L("Expected  error posibilities %d %d"), KErrArgument, KErrNotSupported);
  1.2677 +					StopTest(err, EFail);
  1.2678 +					}
  1.2679 +				}
  1.2680 +			else if (aDevSoundEvent == EEventInitComplete && aError != KErrNone)
  1.2681 +				{
  1.2682 +				ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error = %d"), aError);
  1.2683 +				StopTest(aError);
  1.2684 +				}
  1.2685 +			else
  1.2686 +				{
  1.2687 +				ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent);
  1.2688 +				StopTest(aError, EFail);
  1.2689 +				}
  1.2690 +			break;
  1.2691 +			}
  1.2692 +		default:
  1.2693 +			{
  1.2694 +			ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState);
  1.2695 +			StopTest(aError, EFail);
  1.2696 +			}
  1.2697 +		}
  1.2698 +	}
  1.2699 +
  1.2700 +/*
  1.2701 + *========================================================================================================
  1.2702 + * MM-A3F-DEVSOUND-CHRTZ-TONE-0020
  1.2703 + */
  1.2704 +RA3FDevSoundToneSetDTMFLengthsToNegativeTest::RA3FDevSoundToneSetDTMFLengthsToNegativeTest(const TDesC& aTestName)
  1.2705 +	:	RA3FDevSoundTestBase(aTestName), iToneOnLength(0),
  1.2706 +		iToneOffLength(0), iPauseLength(0),
  1.2707 +		iDTMFString(KNullDesC)
  1.2708 +	{
  1.2709 +	}
  1.2710 +
  1.2711 +RA3FDevSoundToneSetDTMFLengthsToNegativeTest* RA3FDevSoundToneSetDTMFLengthsToNegativeTest::NewL(const TDesC& aTestName)
  1.2712 +	{
  1.2713 +	RA3FDevSoundToneSetDTMFLengthsToNegativeTest * self = new(ELeave)RA3FDevSoundToneSetDTMFLengthsToNegativeTest(aTestName);
  1.2714 +	return self;
  1.2715 +	}
  1.2716 +
  1.2717 +void RA3FDevSoundToneSetDTMFLengthsToNegativeTest::DoKickoffTestL()
  1.2718 +	{
  1.2719 +	if ( !GetIntFromConfig(iTestStepName, KToneOnLength, iToneOnLength) )
  1.2720 +		{
  1.2721 +		ERR_PRINTF2(KMsgErrorGetParameter, &KToneOnLength);
  1.2722 +		StopTest(KErrNotFound);
  1.2723 +		return;
  1.2724 +		}
  1.2725 +	if ( !GetIntFromConfig(iTestStepName, KToneOffLength, iToneOffLength) )
  1.2726 +		{
  1.2727 +		ERR_PRINTF2(KMsgErrorGetParameter, &KToneOffLength);
  1.2728 +		StopTest(KErrNotFound);
  1.2729 +		return;
  1.2730 +		}
  1.2731 +	if ( !GetIntFromConfig(iTestStepName, KPauseLength, iPauseLength) )
  1.2732 +		{
  1.2733 +		ERR_PRINTF2(KMsgErrorGetParameter, &KPauseLength);
  1.2734 +		StopTest(KErrNotFound);
  1.2735 +		return;
  1.2736 +		}
  1.2737 +	TPtrC DTMF;
  1.2738 +	if ( !GetStringFromConfig(iTestStepName,  KDTMFString,  DTMF) )
  1.2739 +		{
  1.2740 +		ERR_PRINTF2(KMsgErrorGetParameter, &KDTMFString);
  1.2741 +		StopTest(KErrNotFound);
  1.2742 +		return;
  1.2743 +		}
  1.2744 +	iDTMFString.Copy(DTMF);
  1.2745 +	}
  1.2746 +
  1.2747 +void RA3FDevSoundToneSetDTMFLengthsToNegativeTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError)
  1.2748 +	{
  1.2749 +	switch (iDevSoundState)
  1.2750 +		{
  1.2751 +		case EStateCreated:
  1.2752 +			{
  1.2753 +			__ASSERT_ALWAYS((aError == KErrNone), Panic(_L("RA3FDevSoundToneSetDTMFLengthsToNegativeConfigurationTest"), EFsmIncorrectErrorPassed));
  1.2754 +			if (aDevSoundEvent == EEventInitialize)
  1.2755 +				{
  1.2756 +				INFO_PRINTF1(_L("Calling iMMFDevSound::InitializeL"));
  1.2757 +				TRAPD(err, iMMFDevSound->InitializeL(*this, EMMFStateTonePlaying));
  1.2758 +				if (err != KErrNone)
  1.2759 +					{
  1.2760 +					ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err);
  1.2761 +					StopTest(err);
  1.2762 +					break;
  1.2763 +					}
  1.2764 +				INFO_PRINTF1(_L("DevSound State: EStateInitializing"));
  1.2765 +				iDevSoundState = EStateInitializing;
  1.2766 +				}
  1.2767 +			else
  1.2768 +				{
  1.2769 +				ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent);
  1.2770 +				StopTest(aError, EFail);
  1.2771 +				}
  1.2772 +			break;
  1.2773 +			}
  1.2774 +		case EStateInitializing:
  1.2775 +			{
  1.2776 +			if (aDevSoundEvent == EEventInitComplete && aError == KErrNone)
  1.2777 +				{
  1.2778 +				iMMFDevSound->SetVolume(iMMFDevSound->MaxVolume());
  1.2779 +				TTimeIntervalMicroSeconds32 ToneOnLength(iToneOnLength);
  1.2780 +				TTimeIntervalMicroSeconds32 ToneOffLength(iToneOffLength);
  1.2781 +				TTimeIntervalMicroSeconds32 PauseLength(iPauseLength);
  1.2782 +				INFO_PRINTF4(_L("Setting DTMF tone to negative lengths. ToneOnLength %d, ToneOffLength %d and PauseLength %d"), iToneOnLength, iToneOffLength, iPauseLength);
  1.2783 +				iMMFDevSound->SetDTMFLengths(ToneOnLength, ToneOffLength, PauseLength);
  1.2784 +				iStartTime.HomeTime();
  1.2785 +				INFO_PRINTF2(_L("Calling CMMFDevSound::PlayDTMFStringL %S"), &iDTMFString);
  1.2786 +				TRAPD(err, iMMFDevSound->PlayDTMFStringL(iDTMFString));
  1.2787 +				if (err != KErrNone)
  1.2788 +					{
  1.2789 +					ERR_PRINTF2(_L("CMMFDevSound::PlayDTMFStringL left with error : %d!"),  err);
  1.2790 +					StopTest(err);
  1.2791 +					break;
  1.2792 +					}
  1.2793 +				INFO_PRINTF1(_L("DevSound State: EStatePlaying"));
  1.2794 +				iDevSoundState = EStatePlaying;
  1.2795 +				}
  1.2796 +			else if (aDevSoundEvent == EEventInitComplete && aError != KErrNone)
  1.2797 +				{
  1.2798 +				ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error = %d"), aError);
  1.2799 +				StopTest(aError);
  1.2800 +				}
  1.2801 +			else
  1.2802 +				{
  1.2803 +				ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent);
  1.2804 +				StopTest(aError, EFail);
  1.2805 +				}
  1.2806 +			break;
  1.2807 +			}
  1.2808 +		default:
  1.2809 +			{
  1.2810 +			ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState);
  1.2811 +			StopTest(aError, EFail);
  1.2812 +			}
  1.2813 +		}
  1.2814 +	}
  1.2815 +
  1.2816 +void RA3FDevSoundToneSetDTMFLengthsToNegativeTest::ToneFinished(TInt aError)
  1.2817 +	{
  1.2818 +	INFO_PRINTF1(_L("========== DevSound ToneFinished() callback =========="));
  1.2819 +	INFO_PRINTF3(KMsgErrorDevSoundCallback, &KToneFinishedText, aError);
  1.2820 +
  1.2821 +	if (aError == KErrUnderflow)
  1.2822 +		{
  1.2823 +		iEndTime.HomeTime();
  1.2824 +		iPlayToneTime = iEndTime.MicroSecondsFrom(iStartTime);
  1.2825 +		if(iPlayToneTime <= KPlayVarianceTime)
  1.2826 +			{
  1.2827 +			INFO_PRINTF2(_L("Setting DTMF tone lengths to negative gives a reproduction time of %Ld microseconds which is the expected result"), iPlayToneTime.Int64());
  1.2828 +			StopTest(aError, EPass);
  1.2829 +			}
  1.2830 +		}
  1.2831 +	else
  1.2832 +		{
  1.2833 +		INFO_PRINTF2(_L("DevSound called ToneFinished with error = %d that was NOT expected"), aError);
  1.2834 +		StopTest(aError, EFail);
  1.2835 +		}
  1.2836 +	}
  1.2837 +
  1.2838 +/*
  1.2839 + *========================================================================================================
  1.2840 + * MM-A3F-DEVSOUND-CHRTZ-TONE-0021
  1.2841 + */
  1.2842 +RA3FDevSoundToneSetDTMFToneOnLengthToMinusOneTest::RA3FDevSoundToneSetDTMFToneOnLengthToMinusOneTest(const TDesC& aTestName)
  1.2843 +	:	RA3FDevSoundTestBase(aTestName),
  1.2844 +		iFirstToneFinishedCall(EFalse),
  1.2845 +		iToneOnLength(0), iToneOffLength(0),
  1.2846 +		iPauseLength(0), iDTMFString(KNullDesC)
  1.2847 +	{
  1.2848 +	}
  1.2849 +RA3FDevSoundToneSetDTMFToneOnLengthToMinusOneTest* RA3FDevSoundToneSetDTMFToneOnLengthToMinusOneTest::NewL(const TDesC& aTestName)
  1.2850 +	{
  1.2851 +	RA3FDevSoundToneSetDTMFToneOnLengthToMinusOneTest * self = new(ELeave)RA3FDevSoundToneSetDTMFToneOnLengthToMinusOneTest(aTestName);
  1.2852 +	return self;
  1.2853 +	}
  1.2854 +
  1.2855 +void RA3FDevSoundToneSetDTMFToneOnLengthToMinusOneTest::DoKickoffTestL()
  1.2856 +	{
  1.2857 +	if (!GetIntFromConfig(iTestStepName, KToneOnLength, iToneOnLength))
  1.2858 +		{
  1.2859 +		ERR_PRINTF2(KMsgErrorGetParameter, &KToneOnLength);
  1.2860 +		StopTest(KErrNotFound);
  1.2861 +		return;
  1.2862 +		}
  1.2863 +	if (!GetIntFromConfig(iTestStepName, KToneOffLength, iToneOffLength))
  1.2864 +		{
  1.2865 +		ERR_PRINTF2(KMsgErrorGetParameter, &KToneOffLength);
  1.2866 +		StopTest(KErrNotFound);
  1.2867 +		return;
  1.2868 +		}
  1.2869 +	if (!GetIntFromConfig(iTestStepName, KPauseLength, iPauseLength))
  1.2870 +		{
  1.2871 +		ERR_PRINTF2(KMsgErrorGetParameter, &KPauseLength);
  1.2872 +		StopTest(KErrNotFound);
  1.2873 +		return;
  1.2874 +		}
  1.2875 +	TPtrC DTMF;
  1.2876 +	if (!GetStringFromConfig(iTestStepName, KDTMFString, DTMF))
  1.2877 +		{
  1.2878 +		ERR_PRINTF2(KMsgErrorGetParameter, &KDTMFString);
  1.2879 +		StopTest(KErrNotFound);
  1.2880 +		return;
  1.2881 +		}
  1.2882 +	iDTMFString.Copy(DTMF);
  1.2883 +	iTimer = CPeriodic::NewL(CActive::EPriorityHigh);
  1.2884 +	}
  1.2885 +
  1.2886 +void RA3FDevSoundToneSetDTMFToneOnLengthToMinusOneTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError)
  1.2887 +	{
  1.2888 +	switch (iDevSoundState)
  1.2889 +		{
  1.2890 +		case EStateCreated:
  1.2891 +			{
  1.2892 +			__ASSERT_ALWAYS((aError == KErrNone), Panic(_L("RA3FDevSoundToneSetDTMFToneOnLengthToMinusOneTest"), EFsmIncorrectErrorPassed));
  1.2893 +			if(aDevSoundEvent == EEventInitialize)
  1.2894 +				{
  1.2895 +				INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL"));
  1.2896 +				TRAPD(err, iMMFDevSound->InitializeL(*this, EMMFStateTonePlaying));
  1.2897 +				if (err != KErrNone)
  1.2898 +					{
  1.2899 +					ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err);
  1.2900 +					StopTest(err);
  1.2901 +					break;
  1.2902 +					}
  1.2903 +				INFO_PRINTF1(_L("DevSound State: EStateInitializing"));
  1.2904 +				iDevSoundState = EStateInitializing;
  1.2905 +				}
  1.2906 +			else
  1.2907 +				{
  1.2908 +				ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent);
  1.2909 +				StopTest(aError, EFail);
  1.2910 +				}
  1.2911 +			break;
  1.2912 +			}
  1.2913 +		case EStateInitializing:
  1.2914 +			{
  1.2915 +			if (aDevSoundEvent == EEventInitComplete && aError == KErrNone)
  1.2916 +				{
  1.2917 +				iMMFDevSound->SetVolume(iMMFDevSound->MaxVolume());
  1.2918 +				iStartTime.HomeTime();
  1.2919 +				TTimeIntervalMicroSeconds32 ToneOnLength(iToneOnLength);
  1.2920 +				TTimeIntervalMicroSeconds32 ToneOffLength(iToneOffLength);
  1.2921 +				TTimeIntervalMicroSeconds32 PauseLength(iPauseLength);
  1.2922 +				INFO_PRINTF4(_L("Calling CMMFDevSound::SetDTMFLengths. ToneOnLength = %Ld, ToneOffLength = %Ld and PauseLength = %Ld"), iToneOnLength, iToneOffLength, iPauseLength);
  1.2923 +				iMMFDevSound->SetDTMFLengths(ToneOnLength, ToneOffLength, PauseLength);
  1.2924 +				INFO_PRINTF2(_L("Calling CMMFDevSound::PlayDTMFStringL %S"), &iDTMFString);
  1.2925 +				TRAPD(err, iMMFDevSound->PlayDTMFStringL(iDTMFString));
  1.2926 +				if (err != KErrNone)
  1.2927 +					{
  1.2928 +					ERR_PRINTF2(_L("CMMFDevSound::PlayDTMFStringL left with error : %d!"), err);
  1.2929 +					StopTest(err);
  1.2930 +					break;
  1.2931 +					}
  1.2932 +				StartTimer(KMicrosecsInTenSec);
  1.2933 +				INFO_PRINTF1(_L("DevSound State: EStatePlaying"));
  1.2934 +				iDevSoundState=EStatePlaying;
  1.2935 +				}
  1.2936 +			else if (aDevSoundEvent == EEventInitComplete && aError != KErrNone)
  1.2937 +				{
  1.2938 +				ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error = %d"), aError);
  1.2939 +				StopTest(aError);
  1.2940 +				}
  1.2941 +			else
  1.2942 +				{
  1.2943 +				ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent);
  1.2944 +				StopTest(aError, EFail);
  1.2945 +				}
  1.2946 +			break;
  1.2947 +			}
  1.2948 +		default:
  1.2949 +			{
  1.2950 +			ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState);
  1.2951 +			StopTest(aError, EFail);
  1.2952 +			}
  1.2953 +		}
  1.2954 +	}
  1.2955 +
  1.2956 +void RA3FDevSoundToneSetDTMFToneOnLengthToMinusOneTest::DoTimerCallback()
  1.2957 +	{
  1.2958 +	iTimer->Cancel();
  1.2959 +	INFO_PRINTF1(_L("DevSound Event: EEventTimerComplete"));
  1.2960 +	iEndTime.HomeTime();
  1.2961 +	iPlayToneTime = iEndTime.MicroSecondsFrom(iStartTime);
  1.2962 +	INFO_PRINTF1(_L("SetDTMF lengths succeded."));
  1.2963 +	INFO_PRINTF2(_L("Play time is %Ld microseconds"), iPlayToneTime.Int64());
  1.2964 +	StopTest();
  1.2965 +	}
  1.2966 +
  1.2967 +void RA3FDevSoundToneSetDTMFToneOnLengthToMinusOneTest::ToneFinished(TInt aError)
  1.2968 +	{
  1.2969 +	INFO_PRINTF1(_L("========== DevSound ToneFinished() callback =========="));
  1.2970 +	if (aError == KErrUnderflow)
  1.2971 +		{
  1.2972 +		INFO_PRINTF1(_L("ToneFinished was called before the timer event."));
  1.2973 +		StopTest(aError);
  1.2974 +		}
  1.2975 +	else
  1.2976 +		{
  1.2977 +		ERR_PRINTF2(_L("DevSound called ToneFinished with error = %d"), aError);
  1.2978 +		ERR_PRINTF2(_L("Expected error = %d"), KErrUnderflow);
  1.2979 +		StopTest(aError, EFail);
  1.2980 +		}
  1.2981 +	}
  1.2982 +
  1.2983 +/*
  1.2984 + *========================================================================================================
  1.2985 + * MM-A3F-DEVSOUND-CHRTZ-TONE-0022
  1.2986 + */
  1.2987 +RA3FDevSoundToneSetToneRepetitionsRepeatTrailingSilenceToNegativeTest::RA3FDevSoundToneSetToneRepetitionsRepeatTrailingSilenceToNegativeTest(const TDesC& aTestName)
  1.2988 +	:	RA3FDevSoundTestBase(aTestName), iDuration(0),
  1.2989 +		iFrequencyTone1(0),
  1.2990 +		iRepeatTrailingSilence(0), iRepeatCount(0),
  1.2991 +		iInitializedToPlayTones(EFalse)
  1.2992 +	{
  1.2993 +	}
  1.2994 +
  1.2995 +RA3FDevSoundToneSetToneRepetitionsRepeatTrailingSilenceToNegativeTest* RA3FDevSoundToneSetToneRepetitionsRepeatTrailingSilenceToNegativeTest::NewL(const TDesC& aTestName)
  1.2996 +	{
  1.2997 +	RA3FDevSoundToneSetToneRepetitionsRepeatTrailingSilenceToNegativeTest * self = new(ELeave)RA3FDevSoundToneSetToneRepetitionsRepeatTrailingSilenceToNegativeTest(aTestName);
  1.2998 +	return self;
  1.2999 +	}
  1.3000 +
  1.3001 +void RA3FDevSoundToneSetToneRepetitionsRepeatTrailingSilenceToNegativeTest::DoKickoffTestL()
  1.3002 +	{
  1.3003 +	if (!GetIntFromConfig(iTestStepName, KRepeatCount, iRepeatCount))
  1.3004 +		{
  1.3005 +		ERR_PRINTF2(KMsgErrorGetParameter, &KRepeatCount);
  1.3006 +		StopTest(KErrNotFound);
  1.3007 +		return;
  1.3008 +		}
  1.3009 +	if (!GetIntFromConfig(iTestStepName, KRepeatTrailingSilence, iRepeatTrailingSilence))
  1.3010 +		{
  1.3011 +		ERR_PRINTF2(KMsgErrorGetParameter, &KRepeatTrailingSilence);
  1.3012 +		StopTest(KErrNotFound);
  1.3013 +		return;
  1.3014 +		}
  1.3015 +	if (!GetIntFromConfig(iTestStepName, KDuration, iDuration))
  1.3016 +		{
  1.3017 +		ERR_PRINTF2(KMsgErrorGetParameter, &KDuration);
  1.3018 +		StopTest(KErrNotFound);
  1.3019 +		return;
  1.3020 +		}
  1.3021 +	if (!GetIntFromConfig(iTestStepName, KFrequencyTone1, iFrequencyTone1))
  1.3022 +		{
  1.3023 +		ERR_PRINTF2(KMsgErrorGetParameter, &KFrequencyTone1);
  1.3024 +		StopTest(KErrNotFound);
  1.3025 +		return;
  1.3026 +		}
  1.3027 +	}
  1.3028 +
  1.3029 +void RA3FDevSoundToneSetToneRepetitionsRepeatTrailingSilenceToNegativeTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError)
  1.3030 +	{
  1.3031 +	switch (iDevSoundState)
  1.3032 +		{
  1.3033 +		case EStateCreated:
  1.3034 +			{
  1.3035 +			__ASSERT_ALWAYS((aError == KErrNone), Panic(_L("RA3FDevSoundToneSetToneRepetitionsRepeatTrailingSilenceToNegativeTest"), EFsmIncorrectErrorPassed));
  1.3036 +			if(aDevSoundEvent == EEventInitialize)
  1.3037 +				{
  1.3038 +				INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL"));
  1.3039 +				TRAPD(err, iMMFDevSound->InitializeL(*this, EMMFStateTonePlaying));
  1.3040 +				if (err != KErrNone)
  1.3041 +					{
  1.3042 +					ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err);
  1.3043 +					StopTest(err);
  1.3044 +					break;
  1.3045 +					}
  1.3046 +				INFO_PRINTF1(_L("DevSound State: EStateInitializing"));
  1.3047 +				iDevSoundState = EStateInitializing;
  1.3048 +				}
  1.3049 +			else
  1.3050 +				{
  1.3051 +				ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent);
  1.3052 +				StopTest(aError, EFail);
  1.3053 +				}
  1.3054 +			break;
  1.3055 +			}
  1.3056 +		case EStateInitializing:
  1.3057 +			{
  1.3058 +			if (aDevSoundEvent == EEventInitComplete && aError == KErrNone)
  1.3059 +				{
  1.3060 +				iMMFDevSound->SetVolume(iMMFDevSound->MaxVolume());
  1.3061 +				INFO_PRINTF3(_L("Calling CMMFDevSound::SetToneRepeats using RepeatCount = %d and RepeatTrailingSilence = %d microsecs"), iRepeatCount, iRepeatTrailingSilence);
  1.3062 +				iMMFDevSound->SetToneRepeats(iRepeatCount, iRepeatTrailingSilence);
  1.3063 +				iStartTime.HomeTime();
  1.3064 +				INFO_PRINTF3(_L("Calling CMMFDevSound::PlayToneL %d Hz during %d secs "), iFrequencyTone1, iDuration);
  1.3065 +				TRAPD(err, iMMFDevSound->PlayToneL(iFrequencyTone1, iDuration*KMicroSecsInOneSec));
  1.3066 +				if (err != KErrNone)
  1.3067 +					{
  1.3068 +					ERR_PRINTF2(_L("CMMFDevSound::PlayToneL left with error : %d!"), err);
  1.3069 +					StopTest(err);
  1.3070 +					break;
  1.3071 +					}
  1.3072 +				INFO_PRINTF1(_L("DevSound State: EStatePlaying"));
  1.3073 +				iDevSoundState = EStatePlaying;
  1.3074 +				}
  1.3075 +			else if (aDevSoundEvent == EEventInitComplete && aError != KErrNone)
  1.3076 +				{
  1.3077 +				ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error = %d"), aError);
  1.3078 +				StopTest(aError);
  1.3079 +				}
  1.3080 +			else
  1.3081 +				{
  1.3082 +				ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent);
  1.3083 +				StopTest(aError, EFail);
  1.3084 +				}
  1.3085 +			break;
  1.3086 +			}
  1.3087 +		default:
  1.3088 +			{
  1.3089 +			ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState);
  1.3090 +			StopTest(aError, EFail);
  1.3091 +			}
  1.3092 +		}
  1.3093 +	}
  1.3094 +
  1.3095 +
  1.3096 +void RA3FDevSoundToneSetToneRepetitionsRepeatTrailingSilenceToNegativeTest::ToneFinished(TInt aError)
  1.3097 +	{
  1.3098 +	INFO_PRINTF1(_L("========== DevSound ToneFinished() callback =========="));
  1.3099 +	if (aError == KErrUnderflow)
  1.3100 +		{
  1.3101 +		iEndTime.HomeTime();
  1.3102 +		iPlayToneTime = iEndTime.MicroSecondsFrom(iStartTime);
  1.3103 +		TInt repeatTrailingSilenceToSecs = iRepeatTrailingSilence/KMicroSecsInOneSec;
  1.3104 +		TInt totalExpectedReproductionTime = (iRepeatCount * iDuration + iDuration + (repeatTrailingSilenceToSecs*iRepeatCount))*KMicroSecsInOneSec;
  1.3105 +		if(iPlayToneTime < totalExpectedReproductionTime + KPlayVarianceTime && iPlayToneTime > totalExpectedReproductionTime - KPlayVarianceTime)
  1.3106 +			{
  1.3107 +			INFO_PRINTF1(_L("Play tone repeats succeded."));
  1.3108 +			INFO_PRINTF2(_L("Play time is %Ld microseconds"), iPlayToneTime.Int64());
  1.3109 +			StopTest();
  1.3110 +			}
  1.3111 +		else
  1.3112 +			{
  1.3113 +			ERR_PRINTF1(_L("Play tone repeats did not work as planned."));
  1.3114 +			ERR_PRINTF3(_L("Play time is %Ld microseconds and it should have been %d microseconds"), iPlayToneTime.Int64(), totalExpectedReproductionTime);
  1.3115 +			StopTest(KErrNone, EFail);
  1.3116 +			}
  1.3117 +		}
  1.3118 +	else
  1.3119 +		{
  1.3120 +		ERR_PRINTF2(_L("DevSound called ToneFinished with error = %d"), aError);
  1.3121 +		ERR_PRINTF2(_L("Expected error = %d"), KErrUnderflow);
  1.3122 +		StopTest(aError);
  1.3123 +		}
  1.3124 +	}
  1.3125 +
  1.3126 +/*
  1.3127 + *========================================================================================================
  1.3128 + * MM-A3F-DEVSOUND-CHRTZ-TONE-0023
  1.3129 + */
  1.3130 +RA3FDevSoundToneSetToneRepetitionsRepeatCountToKMdaRepeatForeverTest::RA3FDevSoundToneSetToneRepetitionsRepeatCountToKMdaRepeatForeverTest(const TDesC& aTestName)
  1.3131 +	:	RA3FDevSoundTestBase(aTestName), iDuration(0),
  1.3132 +		iFrequencyTone1(0),
  1.3133 +		iRepeatTrailingSilence(0), iRepeatCount(0),
  1.3134 +		iInitializedToPlayTones(EFalse)
  1.3135 +	{
  1.3136 +	}
  1.3137 +
  1.3138 +RA3FDevSoundToneSetToneRepetitionsRepeatCountToKMdaRepeatForeverTest* RA3FDevSoundToneSetToneRepetitionsRepeatCountToKMdaRepeatForeverTest::NewL(const TDesC& aTestName)
  1.3139 +	{
  1.3140 +	RA3FDevSoundToneSetToneRepetitionsRepeatCountToKMdaRepeatForeverTest * self = new(ELeave)RA3FDevSoundToneSetToneRepetitionsRepeatCountToKMdaRepeatForeverTest(aTestName);
  1.3141 +	return self;
  1.3142 +	}
  1.3143 +
  1.3144 +void RA3FDevSoundToneSetToneRepetitionsRepeatCountToKMdaRepeatForeverTest::DoKickoffTestL()
  1.3145 +	{
  1.3146 +	if (!GetIntFromConfig(iTestStepName, KRepeatCount, iRepeatCount))
  1.3147 +		{
  1.3148 +		ERR_PRINTF2(KMsgErrorGetParameter, &KRepeatCount);
  1.3149 +		StopTest(KErrNotFound);
  1.3150 +		return;
  1.3151 +		}
  1.3152 +	if (!GetIntFromConfig(iTestStepName, KRepeatTrailingSilence, iRepeatTrailingSilence))
  1.3153 +		{
  1.3154 +		ERR_PRINTF2(KMsgErrorGetParameter, &KRepeatTrailingSilence);
  1.3155 +		StopTest(KErrNotFound);
  1.3156 +		return;
  1.3157 +		}
  1.3158 +	if (!GetIntFromConfig(iTestStepName, KDuration, iDuration))
  1.3159 +		{
  1.3160 +		ERR_PRINTF2(KMsgErrorGetParameter, &KDuration);
  1.3161 +		StopTest(KErrNotFound);
  1.3162 +		return;
  1.3163 +		}
  1.3164 +	if (!GetIntFromConfig(iTestStepName, KFrequencyTone1, iFrequencyTone1))
  1.3165 +		{
  1.3166 +		ERR_PRINTF2(KMsgErrorGetParameter, &KFrequencyTone1);
  1.3167 +		StopTest(KErrNotFound);
  1.3168 +		return;
  1.3169 +		}
  1.3170 +	iTimer = CPeriodic::NewL(CActive::EPriorityHigh);
  1.3171 +	}
  1.3172 +
  1.3173 +void RA3FDevSoundToneSetToneRepetitionsRepeatCountToKMdaRepeatForeverTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError)
  1.3174 +	{
  1.3175 +	switch (iDevSoundState)
  1.3176 +		{
  1.3177 +		case EStateCreated:
  1.3178 +			{
  1.3179 +			__ASSERT_ALWAYS((aError == KErrNone), Panic(_L("RA3FDevSoundToneSetToneRepetitionsRepeatCountToKMdaRepeatForeverTest"), EFsmIncorrectErrorPassed));
  1.3180 +			if(aDevSoundEvent == EEventInitialize)
  1.3181 +				{
  1.3182 +				INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL"));
  1.3183 +				TRAPD(err, iMMFDevSound->InitializeL(*this, EMMFStateTonePlaying));
  1.3184 +				if (err != KErrNone)
  1.3185 +					{
  1.3186 +					ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err);
  1.3187 +					StopTest(err);
  1.3188 +					break;
  1.3189 +					}
  1.3190 +				StartTimer(KMicrosecsInTenSec);
  1.3191 +				INFO_PRINTF1(_L("DevSound State: EStateInitializing"));
  1.3192 +				iDevSoundState = EStateInitializing;
  1.3193 +				}
  1.3194 +			else
  1.3195 +				{
  1.3196 +				ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent);
  1.3197 +				StopTest(aError, EFail);
  1.3198 +				}
  1.3199 +			break;
  1.3200 +			}
  1.3201 +		case EStateInitializing:
  1.3202 +			{
  1.3203 +			if (aDevSoundEvent == EEventInitComplete && aError == KErrNone)
  1.3204 +				{
  1.3205 +				iMMFDevSound->SetVolume(iMMFDevSound->MaxVolume());
  1.3206 +				INFO_PRINTF3(_L("Calling CMMFDevSound::SetToneRepeats using RepeatCount = %d and RepeatTrailingSilence = %d microsecs"), iRepeatCount, iRepeatTrailingSilence);
  1.3207 +				iMMFDevSound->SetToneRepeats(iRepeatCount, iRepeatTrailingSilence);
  1.3208 +				iStartTime.HomeTime();
  1.3209 +				INFO_PRINTF3(_L("Calling CMMFDevSound::PlayToneL %d Hz during %d secs "), iFrequencyTone1, iDuration);
  1.3210 +				TRAPD(err, iMMFDevSound->PlayToneL(iFrequencyTone1, iDuration*KMicroSecsInOneSec));
  1.3211 +				if (err != KErrNone)
  1.3212 +					{
  1.3213 +					ERR_PRINTF2(_L("CMMFDevSound::PlayToneL left with error : %d!"), err);
  1.3214 +					StopTest(err);
  1.3215 +					break;
  1.3216 +					}
  1.3217 +				INFO_PRINTF1(_L("DevSound State: EStatePlaying"));
  1.3218 +				iDevSoundState = EStatePlaying;
  1.3219 +				}
  1.3220 +			else if (aDevSoundEvent == EEventInitComplete && aError != KErrNone)
  1.3221 +				{
  1.3222 +				ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error = %d"), aError);
  1.3223 +				StopTest(aError);
  1.3224 +				}
  1.3225 +			else
  1.3226 +				{
  1.3227 +				ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent);
  1.3228 +				StopTest(aError, EFail);
  1.3229 +				}
  1.3230 +			break;
  1.3231 +			}
  1.3232 +		default:
  1.3233 +			{
  1.3234 +			ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState);
  1.3235 +			StopTest(aError, EFail);
  1.3236 +			}
  1.3237 +		}
  1.3238 +	}
  1.3239 +
  1.3240 +
  1.3241 +void RA3FDevSoundToneSetToneRepetitionsRepeatCountToKMdaRepeatForeverTest::DoTimerCallback()
  1.3242 +	{
  1.3243 +	iTimer->Cancel();
  1.3244 +	INFO_PRINTF1(_L("DevSound Event: EEventTimerComplete"));
  1.3245 +	iEndTime.HomeTime();
  1.3246 +	iPlayToneTime = iEndTime.MicroSecondsFrom(iStartTime);
  1.3247 +	INFO_PRINTF1(_L("Setting repeatCount value to KMdaRepeatForeverTest succeded."));
  1.3248 +	INFO_PRINTF2(_L("Play time is %Ld microseconds"), iPlayToneTime.Int64());
  1.3249 +	iMMFDevSound->Stop();
  1.3250 +	StopTest();
  1.3251 +	}
  1.3252 +
  1.3253 +void RA3FDevSoundToneSetToneRepetitionsRepeatCountToKMdaRepeatForeverTest::ToneFinished(TInt aError)
  1.3254 +	{
  1.3255 +	INFO_PRINTF1(_L("========== DevSound ToneFinished() callback =========="));
  1.3256 +	if (aError == KErrUnderflow)
  1.3257 +		{
  1.3258 +		INFO_PRINTF1(_L("ToneFinished was called before the timer event."));
  1.3259 +		StopTest(aError);
  1.3260 +		}
  1.3261 +	else
  1.3262 +		{
  1.3263 +		ERR_PRINTF2(_L("DevSound called ToneFinished with error = %d"), aError);
  1.3264 +		ERR_PRINTF2(_L("Expected error = %d"), KErrUnderflow);
  1.3265 +		StopTest(aError, EFail);
  1.3266 +		}
  1.3267 +	}
  1.3268 +
  1.3269 +/*
  1.3270 + *========================================================================================================
  1.3271 + * MM-A3F-DEVSOUND-CHRTZ-TONE-0024
  1.3272 + */
  1.3273 +RA3FDevSoundToneCapsTest::RA3FDevSoundToneCapsTest(const TDesC& aTestName)
  1.3274 +	:	RA3FDevSoundTestBase(aTestName), iExCapRate(0), iExCapChannels(0)
  1.3275 +	{
  1.3276 +	}
  1.3277 +
  1.3278 +RA3FDevSoundToneCapsTest* RA3FDevSoundToneCapsTest::NewL(const TDesC& aTestName)
  1.3279 +	{
  1.3280 +	RA3FDevSoundToneCapsTest * self = new(ELeave)RA3FDevSoundToneCapsTest(aTestName);
  1.3281 +	return self;
  1.3282 +	}
  1.3283 +
  1.3284 +void RA3FDevSoundToneCapsTest::DoKickoffTestL()
  1.3285 +	{
  1.3286 +	if (!GetIntFromConfig(iTestStepName, KExCapRate, iExCapRate))
  1.3287 +		{
  1.3288 +		ERR_PRINTF2(KMsgErrorGetParameter, &KSampleRate);
  1.3289 +		StopTest(KErrNotFound);
  1.3290 +		return;
  1.3291 +		}
  1.3292 +	if (!GetIntFromConfig(iTestStepName, KExCapChannels, iExCapChannels))
  1.3293 +		{
  1.3294 +		ERR_PRINTF2(KMsgErrorGetParameter, &KChannel);
  1.3295 +		StopTest(KErrNotFound);
  1.3296 +		return;
  1.3297 +		}
  1.3298 +	}
  1.3299 +
  1.3300 +void RA3FDevSoundToneCapsTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError)
  1.3301 +	{
  1.3302 +	switch(iDevSoundState)
  1.3303 +		{
  1.3304 +		case EStateCreated:
  1.3305 +			{
  1.3306 +			__ASSERT_ALWAYS((aError == KErrNone), Panic(_L("RA3FDevSoundToneCapsTest"), EFsmIncorrectErrorPassed));
  1.3307 +			if (aDevSoundEvent == EEventInitialize)
  1.3308 +				{
  1.3309 +				INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL"));
  1.3310 +				TRAPD(err, iMMFDevSound->InitializeL(*this, EMMFStateTonePlaying));
  1.3311 +				if (err != KErrNone)
  1.3312 +					{
  1.3313 +					ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err);
  1.3314 +					StopTest(err);
  1.3315 +					break;
  1.3316 +					}
  1.3317 +				INFO_PRINTF1(_L("DevSound State: EStateInitializing"));
  1.3318 +				iDevSoundState = EStateInitializing;
  1.3319 +				}
  1.3320 +			else
  1.3321 +				{
  1.3322 +				ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent);
  1.3323 +				StopTest(aError,  EFail);
  1.3324 +				}
  1.3325 +			break;
  1.3326 +			}
  1.3327 +		case EStateInitializing:
  1.3328 +			{
  1.3329 +			if (aDevSoundEvent == EEventInitComplete && aError == KErrNone)
  1.3330 +				{
  1.3331 +				TMMFCapabilities capabilities;
  1.3332 +				INFO_PRINTF1(_L("Calling CMMFDevSound::Capabilities"));
  1.3333 +				capabilities = iMMFDevSound->Capabilities();
  1.3334 +				PrintSupportedCapabilities(capabilities.iRate, capabilities.iChannels);
  1.3335 +				if(capabilities.iRate == iExCapRate)
  1.3336 +					{
  1.3337 +					INFO_PRINTF2(_L("The total of possible sample rate values is 0x%08x"), capabilities.iRate);
  1.3338 +					}
  1.3339 +				else
  1.3340 +					{
  1.3341 +					ERR_PRINTF2(_L("The total of possible sample rate values failed with 0x%08x"), capabilities.iRate);
  1.3342 +					ERR_PRINTF2(_L("Expected value = %d"), iExCapRate);
  1.3343 +					StopTest(aError, EFail);
  1.3344 +					}
  1.3345 +				if(capabilities.iChannels == iExCapChannels)
  1.3346 +					{
  1.3347 +					INFO_PRINTF2(_L("The total of possible channel values is 0x%08x"),capabilities.iChannels );
  1.3348 +					StopTest();
  1.3349 +					}
  1.3350 +				else
  1.3351 +					{
  1.3352 +					ERR_PRINTF2(_L("The total of possible channel values failed with 0x%08x"), capabilities.iChannels );
  1.3353 +					ERR_PRINTF2(_L("Expected value = %d"), iExCapChannels);
  1.3354 +					StopTest(aError, EFail);
  1.3355 +					}
  1.3356 +				}
  1.3357 +			else if (aDevSoundEvent == EEventInitComplete && aError != KErrNone)
  1.3358 +				{
  1.3359 +				ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error = %d"), aError);
  1.3360 +				StopTest(aError);
  1.3361 +				}
  1.3362 +			else
  1.3363 +				{
  1.3364 +				ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent);
  1.3365 +				StopTest(aError, EFail);
  1.3366 +				}
  1.3367 +			break;
  1.3368 +			}
  1.3369 +		default:
  1.3370 +			{
  1.3371 +			ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState);
  1.3372 +			StopTest(aError, EFail);
  1.3373 +			}
  1.3374 +		}
  1.3375 +	}
  1.3376 +
  1.3377 +/*
  1.3378 + *========================================================================================================
  1.3379 + * MM-A3F-DEVSOUND-CHRTZ-TONE-0025
  1.3380 + */
  1.3381 +RA3FDevSoundToneConfigDefaultTest::RA3FDevSoundToneConfigDefaultTest(const TDesC& aTestName)
  1.3382 +	:	RA3FDevSoundTestBase(aTestName), iExCapRate(0),
  1.3383 +		iExCapChannels(0)
  1.3384 +	{
  1.3385 +	}
  1.3386 +
  1.3387 +RA3FDevSoundToneConfigDefaultTest* RA3FDevSoundToneConfigDefaultTest::NewL(const TDesC& aTestName)
  1.3388 +	{
  1.3389 +	RA3FDevSoundToneConfigDefaultTest * self = new(ELeave)RA3FDevSoundToneConfigDefaultTest(aTestName);
  1.3390 +	return self;
  1.3391 +	}
  1.3392 +
  1.3393 +void RA3FDevSoundToneConfigDefaultTest::DoKickoffTestL()
  1.3394 +	{
  1.3395 +	if (!GetIntFromConfig(iTestStepName, KExCapRate, iExCapRate))
  1.3396 +			{
  1.3397 +			ERR_PRINTF2(KMsgErrorGetParameter, &KExCapRate);
  1.3398 +			StopTest(KErrNotFound);
  1.3399 +			return;
  1.3400 +			}
  1.3401 +	if (!GetIntFromConfig(iTestStepName, KExCapChannels, iExCapChannels))
  1.3402 +		{
  1.3403 +		ERR_PRINTF2(KMsgErrorGetParameter, &KExCapChannels);
  1.3404 +		StopTest(KErrNotFound);
  1.3405 +		return;
  1.3406 +		}
  1.3407 +	}
  1.3408 +
  1.3409 +void RA3FDevSoundToneConfigDefaultTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError)
  1.3410 +	{
  1.3411 +		switch(iDevSoundState)
  1.3412 +		{
  1.3413 +		case EStateCreated:
  1.3414 +			{
  1.3415 +			__ASSERT_ALWAYS((aError == KErrNone), Panic(_L("RA3FDevSoundToneConfigDefaultTest"), EFsmIncorrectErrorPassed));
  1.3416 +			if (aDevSoundEvent == EEventInitialize)
  1.3417 +				{
  1.3418 +				INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL"));
  1.3419 +				TRAPD(err, iMMFDevSound->InitializeL(*this, EMMFStateTonePlaying));
  1.3420 +				if (err != KErrNone)
  1.3421 +					{
  1.3422 +					ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err);
  1.3423 +					StopTest(err);
  1.3424 +					}
  1.3425 +				INFO_PRINTF1(_L("DevSound State: EStateInitializing"));
  1.3426 +				iDevSoundState=EStateInitializing;
  1.3427 +				}
  1.3428 +			else
  1.3429 +				{
  1.3430 +				ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent);
  1.3431 +				StopTest(aError, EFail);
  1.3432 +				}
  1.3433 +			break;
  1.3434 +			}
  1.3435 +		case EStateInitializing:
  1.3436 +			{
  1.3437 +			if (aDevSoundEvent == EEventInitComplete && aError == KErrNone)
  1.3438 +				{
  1.3439 +				TMMFCapabilities capabilitiesGet;
  1.3440 +				TBuf<KMaxSampleRateStringLength> stringSampleRateGet;
  1.3441 +				TBuf<KMaxChannelsStringLength> stringChannelsGet;
  1.3442 +				TBuf<KMaxSampleRateStringLength> stringSampleRateExpected;
  1.3443 +				TBuf<KMaxChannelsStringLength> stringChannelsExpected;
  1.3444 +				INFO_PRINTF1(_L("Calling CMMFDevSound::Config"));
  1.3445 +				capabilitiesGet=iMMFDevSound->Config();
  1.3446 +				SampleRateFromTUintToString (capabilitiesGet.iRate, stringSampleRateGet);
  1.3447 +				ChannelsFromTUintToString (capabilitiesGet.iChannels, stringChannelsGet);
  1.3448 +				SampleRateFromTIntToTMMFSampleRate (iExCapRate, iExSampleRate);
  1.3449 +				SampleRateFromTUintToString (iExSampleRate, stringSampleRateExpected);
  1.3450 +				ChannelsFromTUintToString (iExCapChannels, stringChannelsExpected);
  1.3451 +				if (stringSampleRateExpected.Compare(stringSampleRateGet) == 0)
  1.3452 +					{
  1.3453 +					INFO_PRINTF2(_L("Sample rate value match default as expected with %S"), &stringSampleRateGet);
  1.3454 +					if (stringChannelsExpected.Compare(stringChannelsGet) == 0)
  1.3455 +						{
  1.3456 +						INFO_PRINTF2(_L("Channel mode value match default as expected with %S"), &stringChannelsGet);
  1.3457 +						StopTest();
  1.3458 +						}
  1.3459 +					else
  1.3460 +						{
  1.3461 +						INFO_PRINTF2(_L("Channel mode value failed with %S"), &stringChannelsGet);
  1.3462 +						ERR_PRINTF2(_L("Expected channel mode %S"), &stringChannelsExpected);
  1.3463 +						StopTest(aError, EFail);
  1.3464 +						}
  1.3465 +					}
  1.3466 +				else
  1.3467 +					{
  1.3468 +					ERR_PRINTF2(_L("Sample rate value failed with %S"), &stringSampleRateGet);
  1.3469 +					ERR_PRINTF2(_L("Expected sample rate %S"), &stringSampleRateExpected);
  1.3470 +					StopTest(aError, EFail);
  1.3471 +					}
  1.3472 +				}
  1.3473 +			else if (aDevSoundEvent == EEventInitComplete && aError != KErrNone)
  1.3474 +				{
  1.3475 +				ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error = %d"), aError);
  1.3476 +				StopTest(aError);
  1.3477 +				}
  1.3478 +			else
  1.3479 +				{
  1.3480 +				ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent);
  1.3481 +				StopTest(aError, EFail);
  1.3482 +				}
  1.3483 +			break;
  1.3484 +			}
  1.3485 +		default:
  1.3486 +			{
  1.3487 +			ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState);
  1.3488 +			StopTest(aError, EFail);
  1.3489 +			}
  1.3490 +		}
  1.3491 +	}
  1.3492 +
  1.3493 +/*
  1.3494 + *========================================================================================================
  1.3495 + * MM-A3F-DEVSOUND-CHRTZ-TONE-0026
  1.3496 + */
  1.3497 +RA3FDevSoundToneMaxVolumeTest::RA3FDevSoundToneMaxVolumeTest(const TDesC& aTestName)
  1.3498 +	:	RA3FDevSoundTestBase(aTestName), iExVolume(0)
  1.3499 +	{
  1.3500 +	}
  1.3501 +
  1.3502 +RA3FDevSoundToneMaxVolumeTest* RA3FDevSoundToneMaxVolumeTest::NewL(const TDesC& aTestName)
  1.3503 +	{
  1.3504 +	RA3FDevSoundToneMaxVolumeTest * self = new(ELeave)RA3FDevSoundToneMaxVolumeTest(aTestName);
  1.3505 +	return self;
  1.3506 +	}
  1.3507 +
  1.3508 +void RA3FDevSoundToneMaxVolumeTest::DoKickoffTestL()
  1.3509 +	{
  1.3510 +	if (!GetIntFromConfig(iTestStepName, KExVolume, iExVolume))
  1.3511 +		{
  1.3512 +		ERR_PRINTF2(KMsgErrorGetParameter, &KExVolume);
  1.3513 +		StopTest(KErrNotFound);
  1.3514 +		return;
  1.3515 +		}
  1.3516 +	}
  1.3517 +
  1.3518 +void RA3FDevSoundToneMaxVolumeTest::Fsm(TMmfDevSoundEvent aDevSoundEvent,  TInt aError)
  1.3519 +	{
  1.3520 +	switch(iDevSoundState)
  1.3521 +		{
  1.3522 +		case EStateCreated:
  1.3523 +			{
  1.3524 +			__ASSERT_ALWAYS((aError == KErrNone), Panic(_L("RA3FDevSoundToneMaxVolumeTest"), EFsmIncorrectErrorPassed));
  1.3525 +			if (aDevSoundEvent == EEventInitialize)
  1.3526 +				{
  1.3527 +				INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL"));
  1.3528 +				TRAPD(err, iMMFDevSound->InitializeL(*this, EMMFStateTonePlaying));
  1.3529 +				if (err != KErrNone)
  1.3530 +					{
  1.3531 +					ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err);
  1.3532 +					StopTest(err);
  1.3533 +					break;
  1.3534 +					}
  1.3535 +				INFO_PRINTF1(_L("DevSound State: EStateInitializing"));
  1.3536 +				iDevSoundState = EStateInitializing;
  1.3537 +				}
  1.3538 +			else
  1.3539 +				{
  1.3540 +				ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent);
  1.3541 +				StopTest(aError, EFail);
  1.3542 +				}
  1.3543 +			break;
  1.3544 +			}
  1.3545 +		case EStateInitializing:
  1.3546 +			{
  1.3547 +			if (aDevSoundEvent == EEventInitComplete && aError == KErrNone)
  1.3548 +				{
  1.3549 +				INFO_PRINTF1(_L("Calling CMMFDevSound::MaxVolume"));
  1.3550 +				TInt maxVolumeGet = iMMFDevSound->MaxVolume();
  1.3551 +				if (maxVolumeGet == iExVolume)
  1.3552 +					{
  1.3553 +					INFO_PRINTF2(_L("The max device supported volume is %d."), maxVolumeGet);
  1.3554 +					StopTest();
  1.3555 +					}
  1.3556 +				else
  1.3557 +					{
  1.3558 +					INFO_PRINTF2(_L("The max device supported volume failed with %d."), maxVolumeGet);
  1.3559 +					ERR_PRINTF2(_L("Expected value = %d."), iExVolume);
  1.3560 +					StopTest(aError, EFail);
  1.3561 +					}
  1.3562 +				}
  1.3563 +			else if (aDevSoundEvent == EEventInitComplete && aError != KErrNone)
  1.3564 +				{
  1.3565 +				ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error = %d"), aError);
  1.3566 +				StopTest(aError);
  1.3567 +				}
  1.3568 +			else
  1.3569 +				{
  1.3570 +				ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent);
  1.3571 +				StopTest(aError, EFail);
  1.3572 +				}
  1.3573 +			break;
  1.3574 +			}
  1.3575 +		default:
  1.3576 +			{
  1.3577 +			ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState);
  1.3578 +			StopTest(aError, EFail);
  1.3579 +			}
  1.3580 +		}
  1.3581 +	}
  1.3582 +
  1.3583 +/*
  1.3584 + *========================================================================================================
  1.3585 + * MM-A3F-DEVSOUND-CHRTZ-TONE-0027
  1.3586 + */
  1.3587 +RA3FDevSoundToneVolumeTest::RA3FDevSoundToneVolumeTest(const TDesC& aTestName)
  1.3588 +	:	RA3FDevSoundTestBase(aTestName), iExVolume(0)
  1.3589 +	{
  1.3590 +	}
  1.3591 +
  1.3592 +RA3FDevSoundToneVolumeTest* RA3FDevSoundToneVolumeTest::NewL(const TDesC& aTestName)
  1.3593 +	{
  1.3594 +	RA3FDevSoundToneVolumeTest * self = new(ELeave)RA3FDevSoundToneVolumeTest(aTestName);
  1.3595 +	return self;
  1.3596 +	}
  1.3597 +
  1.3598 +void RA3FDevSoundToneVolumeTest::DoKickoffTestL()
  1.3599 +	{
  1.3600 +	if (!GetIntFromConfig(iTestStepName, KExVolume, iExVolume))
  1.3601 +		{
  1.3602 +		ERR_PRINTF2(KMsgErrorGetParameter, &KExVolume);
  1.3603 +		StopTest(KErrNotFound);
  1.3604 +		return;
  1.3605 +		}
  1.3606 +	}
  1.3607 +
  1.3608 +void RA3FDevSoundToneVolumeTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError)
  1.3609 +	{
  1.3610 +	switch (iDevSoundState)
  1.3611 +		{
  1.3612 +		case EStateCreated:
  1.3613 +			{
  1.3614 +			__ASSERT_ALWAYS((aError == KErrNone), Panic(_L("RA3FDevSoundToneVolumeTest"), EFsmIncorrectErrorPassed));
  1.3615 +			if (aDevSoundEvent == EEventInitialize)
  1.3616 +				{
  1.3617 +				INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL"));
  1.3618 +				TRAPD(err, iMMFDevSound->InitializeL(*this, EMMFStateTonePlaying));
  1.3619 +				if (err != KErrNone)
  1.3620 +					{
  1.3621 +					ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err);
  1.3622 +					StopTest(err);
  1.3623 +					break;
  1.3624 +					}
  1.3625 +				INFO_PRINTF1(_L("DevSound State: EStateInitializing"));
  1.3626 +				iDevSoundState = EStateInitializing;
  1.3627 +				}
  1.3628 +			else
  1.3629 +				{
  1.3630 +				ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent);
  1.3631 +				StopTest(aError, EFail);
  1.3632 +				}
  1.3633 +			break;
  1.3634 +			}
  1.3635 +		case EStateInitializing:
  1.3636 +			{
  1.3637 +			if (aDevSoundEvent == EEventInitComplete && aError == KErrNone)
  1.3638 +				{
  1.3639 +				INFO_PRINTF1(_L("Calling CMMFDevSound::Volume"));
  1.3640 +				TInt volumeGet = iMMFDevSound->Volume();
  1.3641 +				if(volumeGet == iExVolume)
  1.3642 +					{
  1.3643 +					INFO_PRINTF2(_L("Default device volume succeeded with = %d"), volumeGet);
  1.3644 +					StopTest();
  1.3645 +					}
  1.3646 +				else
  1.3647 +					{
  1.3648 +					ERR_PRINTF2(_L("Default device volume failed with = %d"), volumeGet);
  1.3649 +					ERR_PRINTF2(_L("Expected value % d"), iExVolume);
  1.3650 +					StopTest(aError , EFail);
  1.3651 +					}
  1.3652 +				}
  1.3653 +			else if (aDevSoundEvent == EEventInitComplete && aError != KErrNone)
  1.3654 +				{
  1.3655 +				ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error = %d"), aError);
  1.3656 +				StopTest(aError);
  1.3657 +				}
  1.3658 +			else
  1.3659 +				{
  1.3660 +				ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent);
  1.3661 +				StopTest(aError, EFail);
  1.3662 +				}
  1.3663 +			break;
  1.3664 +			}
  1.3665 +		default:
  1.3666 +			{
  1.3667 +			ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState);
  1.3668 +			StopTest(aError, EFail);
  1.3669 +			}
  1.3670 +		}
  1.3671 +	}
  1.3672 +
  1.3673 +
  1.3674 +/*
  1.3675 + *========================================================================================================
  1.3676 + * MM-A3F-DEVSOUND-CHRTZ-TONE-0028
  1.3677 + */
  1.3678 +RA3FDevSoundToneQueryCapsWhilePlayingTest::RA3FDevSoundToneQueryCapsWhilePlayingTest(const TDesC& aTestName)
  1.3679 +	:	RA3FDevSoundTestBase(aTestName), iDuration(0),
  1.3680 +		iFrequencyTone1(0), iExCapRate(0), iExCapChannels(0)
  1.3681 +	{
  1.3682 +	}
  1.3683 +
  1.3684 +RA3FDevSoundToneQueryCapsWhilePlayingTest* RA3FDevSoundToneQueryCapsWhilePlayingTest::NewL(const TDesC& aTestName)
  1.3685 +	{
  1.3686 +	RA3FDevSoundToneQueryCapsWhilePlayingTest * self = new(ELeave)RA3FDevSoundToneQueryCapsWhilePlayingTest(aTestName);
  1.3687 +	return self;
  1.3688 +	}
  1.3689 +
  1.3690 +void RA3FDevSoundToneQueryCapsWhilePlayingTest::DoKickoffTestL()
  1.3691 +	{
  1.3692 +	if (!GetIntFromConfig(iTestStepName, KDuration, iDuration))
  1.3693 +		{
  1.3694 +		ERR_PRINTF2(KMsgErrorGetParameter, &KDuration);
  1.3695 +		StopTest(KErrNotFound);
  1.3696 +		return;
  1.3697 +		}
  1.3698 +	if (!GetIntFromConfig(iTestStepName, KFrequencyTone1, iFrequencyTone1))
  1.3699 +		{
  1.3700 +		ERR_PRINTF2(KMsgErrorGetParameter, &KFrequencyTone1);
  1.3701 +		StopTest(KErrNotFound);
  1.3702 +		return;
  1.3703 +		}
  1.3704 +	if (!GetIntFromConfig(iTestStepName, KExCapRate, iExCapRate))
  1.3705 +		{
  1.3706 +		ERR_PRINTF2(KMsgErrorGetParameter, &KSampleRate);
  1.3707 +		StopTest(KErrNotFound);
  1.3708 +		return;
  1.3709 +		}
  1.3710 +	if (!GetIntFromConfig(iTestStepName, KExCapChannels, iExCapChannels))
  1.3711 +		{
  1.3712 +		ERR_PRINTF2(KMsgErrorGetParameter, &KChannel);
  1.3713 +		StopTest(KErrNotFound);
  1.3714 +		return;
  1.3715 +		}
  1.3716 +	iTimer = CPeriodic::NewL(CActive::EPriorityHigh);
  1.3717 +	}
  1.3718 +
  1.3719 +void RA3FDevSoundToneQueryCapsWhilePlayingTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError)
  1.3720 +	{
  1.3721 +	switch (iDevSoundState)
  1.3722 +		{
  1.3723 +		case EStateCreated:
  1.3724 +			{
  1.3725 +			__ASSERT_ALWAYS((aError == KErrNone), Panic(_L("RA3FDevSoundToneQueryCapsWhilePlayingTest"), EFsmIncorrectErrorPassed));
  1.3726 +			if (aDevSoundEvent == EEventInitialize)
  1.3727 +				{
  1.3728 +				INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL"));
  1.3729 +				TRAPD(err, iMMFDevSound->InitializeL(*this, EMMFStateTonePlaying));
  1.3730 +				if (err != KErrNone)
  1.3731 +					{
  1.3732 +					ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err);
  1.3733 +					StopTest(err);
  1.3734 +					break;
  1.3735 +					}
  1.3736 +				INFO_PRINTF1(_L("DevSound State: EStateInitializing"));
  1.3737 +				iDevSoundState = EStateInitializing;
  1.3738 +				}
  1.3739 +			else
  1.3740 +				{
  1.3741 +				ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent);
  1.3742 +				StopTest(aError, EFail);
  1.3743 +				}
  1.3744 +			break;
  1.3745 +			}
  1.3746 +		case EStateInitializing:
  1.3747 +			{
  1.3748 +			if (aDevSoundEvent == EEventInitComplete && aError == KErrNone)
  1.3749 +				{
  1.3750 +				INFO_PRINTF3(_L("Calling CMMFDevSound::PlayToneL using %d Hz during %d secs "), iFrequencyTone1, iDuration);
  1.3751 +				TRAPD(err, iMMFDevSound->PlayToneL(iFrequencyTone1, iDuration*KMicroSecsInOneSec));
  1.3752 +				if (err != KErrNone)
  1.3753 +					{
  1.3754 +					ERR_PRINTF2(_L("CMMFDevSound::PlayToneL left with error : %d!"), err);
  1.3755 +					StopTest(err);
  1.3756 +					break;
  1.3757 +					}
  1.3758 +				StartTimer(KMicroSecsTwoSec);
  1.3759 +				INFO_PRINTF1(_L("DevSound State: EStatePlaying"));
  1.3760 +				iDevSoundState = EStatePlaying;
  1.3761 +				}
  1.3762 +			else if (aDevSoundEvent == EEventInitComplete && aError != KErrNone)
  1.3763 +				{
  1.3764 +				ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error = %d"), aError);
  1.3765 +				StopTest(aError);
  1.3766 +				}
  1.3767 +			else
  1.3768 +				{
  1.3769 +				ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent);
  1.3770 +				StopTest(aError, EFail);
  1.3771 +				}
  1.3772 +			break;
  1.3773 +			}
  1.3774 +		default:
  1.3775 +			{
  1.3776 +			ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState);
  1.3777 +			StopTest(aError, EFail);
  1.3778 +			}
  1.3779 +		}
  1.3780 +	}
  1.3781 +
  1.3782 +void RA3FDevSoundToneQueryCapsWhilePlayingTest::DoTimerCallback()
  1.3783 +	{
  1.3784 +	iTimer->Cancel();
  1.3785 +	INFO_PRINTF1(_L("DevSound Event: EEventTimerComplete"));
  1.3786 +	TMMFCapabilities capabilities;
  1.3787 +	INFO_PRINTF1(_L("Calling CMMFDevSound::Capabilities"));
  1.3788 +	capabilities = iMMFDevSound->Capabilities();
  1.3789 +	PrintSupportedCapabilities(capabilities.iRate, capabilities.iChannels);
  1.3790 +	if(capabilities.iRate == iExCapRate)
  1.3791 +		{
  1.3792 +		INFO_PRINTF2(_L("The total of possible sample rate values is 0x%08x"), capabilities.iRate);
  1.3793 +		}
  1.3794 +	else
  1.3795 +		{
  1.3796 +		ERR_PRINTF2(_L("The total of possible sample rate values failed with 0x%08x"), capabilities.iRate);
  1.3797 +		ERR_PRINTF2(_L("Expected value = %d"), iExCapRate);
  1.3798 +		StopTest(KErrNone, EFail);
  1.3799 +		}
  1.3800 +	if(capabilities.iChannels == iExCapChannels)
  1.3801 +		{
  1.3802 +		INFO_PRINTF2(_L("The total of possible channel values is 0x%08x"),capabilities.iChannels );
  1.3803 +		}
  1.3804 +	else
  1.3805 +		{
  1.3806 +		ERR_PRINTF2(_L("The total of possible channel values failed with 0x%08x"), capabilities.iChannels );
  1.3807 +		ERR_PRINTF2(_L("Expected value = %d"), iExCapChannels);
  1.3808 +		StopTest(KErrNone, EFail);
  1.3809 +		}
  1.3810 +	}
  1.3811 +
  1.3812 +/*
  1.3813 + *========================================================================================================
  1.3814 + * MM-A3F-DEVSOUND-CHRTZ-TONE-0029
  1.3815 + */
  1.3816 +RA3FDevSoundToneConfigWhilePlayingTest::RA3FDevSoundToneConfigWhilePlayingTest(const TDesC& aTestName)
  1.3817 +	:	RA3FDevSoundTestBase(aTestName), iDuration(0),
  1.3818 +		iFrequencyTone1(0)
  1.3819 +	{
  1.3820 +	}
  1.3821 +RA3FDevSoundToneConfigWhilePlayingTest* RA3FDevSoundToneConfigWhilePlayingTest::NewL(const TDesC& aTestName)
  1.3822 +	{
  1.3823 +	RA3FDevSoundToneConfigWhilePlayingTest * self = new(ELeave)RA3FDevSoundToneConfigWhilePlayingTest(aTestName);
  1.3824 +	return self;
  1.3825 +	}
  1.3826 +
  1.3827 +void RA3FDevSoundToneConfigWhilePlayingTest::DoKickoffTestL()
  1.3828 +	{
  1.3829 +	if (!GetIntFromConfig(iTestStepName, KDuration, iDuration))
  1.3830 +		{
  1.3831 +		ERR_PRINTF2(KMsgErrorGetParameter, &KDuration);
  1.3832 +		StopTest(KErrNotFound);
  1.3833 +		return;
  1.3834 +		}
  1.3835 +	if (!GetIntFromConfig(iTestStepName, KFrequencyTone1, iFrequencyTone1))
  1.3836 +		{
  1.3837 +		ERR_PRINTF2(KMsgErrorGetParameter, &KFrequencyTone1);
  1.3838 +		StopTest(KErrNotFound);
  1.3839 +		return;
  1.3840 +		}
  1.3841 +	if (!GetIntFromConfig(iTestStepName, KExCapRate, iExCapRate))
  1.3842 +			{
  1.3843 +			ERR_PRINTF2(KMsgErrorGetParameter, &KExCapRate);
  1.3844 +			StopTest(KErrNotFound);
  1.3845 +			return;
  1.3846 +			}
  1.3847 +	if (!GetIntFromConfig(iTestStepName, KExCapChannels, iExCapChannels))
  1.3848 +		{
  1.3849 +		ERR_PRINTF2(KMsgErrorGetParameter, &KExCapChannels);
  1.3850 +		StopTest(KErrNotFound);
  1.3851 +		return;
  1.3852 +		}
  1.3853 +	iTimer = CPeriodic::NewL(CActive::EPriorityHigh);
  1.3854 +	}
  1.3855 +
  1.3856 +void RA3FDevSoundToneConfigWhilePlayingTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError)
  1.3857 +	{
  1.3858 +	switch(iDevSoundState)
  1.3859 +		{
  1.3860 +		case EStateCreated:
  1.3861 +			{
  1.3862 +			__ASSERT_ALWAYS((aError == KErrNone), Panic(_L("RA3FDevSoundToneConfigWhilePlayingTest"), EFsmIncorrectErrorPassed));
  1.3863 +			if (aDevSoundEvent == EEventInitialize)
  1.3864 +				{
  1.3865 +				INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL"));
  1.3866 +				TRAPD(err, iMMFDevSound->InitializeL(*this, EMMFStateTonePlaying));
  1.3867 +				if (err != KErrNone)
  1.3868 +					{
  1.3869 +					ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err);
  1.3870 +					StopTest(err);
  1.3871 +					break;
  1.3872 +					}
  1.3873 +				INFO_PRINTF1(_L("DevSound State: EStateInitializing"));
  1.3874 +				iDevSoundState = EStateInitializing;
  1.3875 +				}
  1.3876 +			else
  1.3877 +				{
  1.3878 +				ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent);
  1.3879 +				StopTest(aError, EFail);
  1.3880 +				}
  1.3881 +			break;
  1.3882 +			}
  1.3883 +		case EStateInitializing:
  1.3884 +			{
  1.3885 +			if (aDevSoundEvent == EEventInitComplete && aError == KErrNone)
  1.3886 +				{
  1.3887 +				iStartTime.HomeTime();
  1.3888 +				INFO_PRINTF3(_L("Calling CMMFDevSound::PlayToneL using %d Hz during %d secs "), iFrequencyTone1, iDuration);
  1.3889 +				TRAPD(err, iMMFDevSound->PlayToneL(iFrequencyTone1, iDuration*KMicroSecsInOneSec));
  1.3890 +				if (err != KErrNone)
  1.3891 +					{
  1.3892 +					ERR_PRINTF2(_L("CMMFDevSound::PlayToneL left with error : %d!"),  err);
  1.3893 +					StopTest(err);
  1.3894 +					break;
  1.3895 +					}
  1.3896 +				StartTimer(KMicroSecsTwoSec);
  1.3897 +				INFO_PRINTF1(_L("DevSound State: EStatePlaying"));
  1.3898 +				iDevSoundState = EStatePlaying;
  1.3899 +				}
  1.3900 +			else if (aDevSoundEvent == EEventInitComplete && aError != KErrNone)
  1.3901 +				{
  1.3902 +				ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error = %d"), aError);
  1.3903 +				StopTest(aError);
  1.3904 +				}
  1.3905 +			else
  1.3906 +				{
  1.3907 +				ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent);
  1.3908 +				StopTest(aError, EFail);
  1.3909 +				}
  1.3910 +			break;
  1.3911 +			}
  1.3912 +		default:
  1.3913 +			{
  1.3914 +			ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState);
  1.3915 +			StopTest(aError, EFail);
  1.3916 +			}
  1.3917 +		}
  1.3918 +	}
  1.3919 +
  1.3920 +void RA3FDevSoundToneConfigWhilePlayingTest::DoTimerCallback()
  1.3921 +	{
  1.3922 +	iTimer->Cancel();
  1.3923 +	INFO_PRINTF1(_L("DevSound Event: EEventTimerComplete"));
  1.3924 +	TMMFCapabilities capabilitiesGet;
  1.3925 +	TBuf<KMaxSampleRateStringLength> stringSampleRateGet;
  1.3926 +	TBuf<KMaxChannelsStringLength> stringChannelsGet;
  1.3927 +	TBuf<KMaxSampleRateStringLength> stringSampleRateExpected;
  1.3928 +	TBuf<KMaxChannelsStringLength> stringChannelsExpected;
  1.3929 +	INFO_PRINTF1(_L("Calling CMMFDevSound::Config while playing"));
  1.3930 +	capabilitiesGet=iMMFDevSound->Config();
  1.3931 +	SampleRateFromTUintToString (capabilitiesGet.iRate, stringSampleRateGet);
  1.3932 +	ChannelsFromTUintToString (capabilitiesGet.iChannels, stringChannelsGet);
  1.3933 +	SampleRateFromTIntToTMMFSampleRate (iExCapRate, iExSampleRate);
  1.3934 +	SampleRateFromTUintToString (iExSampleRate, stringSampleRateExpected);
  1.3935 +	ChannelsFromTUintToString (iExCapChannels, stringChannelsExpected);
  1.3936 +	if (stringSampleRateExpected.Compare(stringSampleRateGet) == 0)
  1.3937 +		{
  1.3938 +		INFO_PRINTF2(_L("Sample rate value match default as expected with %S"), &stringSampleRateGet);
  1.3939 +		if (stringChannelsExpected.Compare(stringChannelsGet) == 0)
  1.3940 +			{
  1.3941 +			INFO_PRINTF2(_L("Channel mode value match default as expected with %S"), &stringChannelsGet);
  1.3942 +			StopTest();
  1.3943 +			}
  1.3944 +		else
  1.3945 +			{
  1.3946 +			INFO_PRINTF2(_L("Channel mode value failed with %S"), &stringChannelsGet);
  1.3947 +			ERR_PRINTF2(_L("Expected channel mode %S"), &stringChannelsExpected);
  1.3948 +			StopTest(KErrNone, EFail);
  1.3949 +			}
  1.3950 +		}
  1.3951 +	else
  1.3952 +		{
  1.3953 +		ERR_PRINTF2(_L("Sample rate value failed with %S"), &stringSampleRateGet);
  1.3954 +		ERR_PRINTF2(_L("Expected sample rate %S"), &stringSampleRateExpected);
  1.3955 +		StopTest(KErrNone, EFail);
  1.3956 +		}
  1.3957 +	}
  1.3958 +
  1.3959 +void RA3FDevSoundToneConfigWhilePlayingTest::ToneFinished(TInt aError)
  1.3960 +	{
  1.3961 +	INFO_PRINTF1(_L("========== DevSound ToneFinished() callback =========="));
  1.3962 +	if (aError == KErrUnderflow)
  1.3963 +		{
  1.3964 +		iEndTime.HomeTime();
  1.3965 +		iPlayToneTime = iEndTime.MicroSecondsFrom(iStartTime);
  1.3966 +		TInt totalExpectedReproductionTime = iDuration * KMicroSecsInOneSec;
  1.3967 +		if(iPlayToneTime < totalExpectedReproductionTime + KPlayVarianceTime && iPlayToneTime > totalExpectedReproductionTime - KPlayVarianceTime)
  1.3968 +			{
  1.3969 +			INFO_PRINTF2(_L("Play time is %Ld microseconds"), iPlayToneTime.Int64());
  1.3970 +			StopTest();
  1.3971 +			}
  1.3972 +		else
  1.3973 +			{
  1.3974 +			ERR_PRINTF3(_L("Play time is %Ld microseconds and it should have been %d microseconds"), iPlayToneTime.Int64(), totalExpectedReproductionTime);
  1.3975 +			StopTest(KErrNone, EFail);
  1.3976 +			}
  1.3977 +		}
  1.3978 +	else
  1.3979 +		{
  1.3980 +		ERR_PRINTF2(_L("DevSound called ToneFinished with error = %d"), aError);
  1.3981 +		ERR_PRINTF2(_L("Expected error = %d"), KErrUnderflow);
  1.3982 +		StopTest(aError, EFail);
  1.3983 +		}
  1.3984 +	}
  1.3985 +
  1.3986 +/*
  1.3987 + *========================================================================================================
  1.3988 + * MM-A3F-DEVSOUND-CHRTZ-TONE-0030
  1.3989 + */
  1.3990 +RA3FDevSoundToneMaxVolumeWhilePlayingTest::RA3FDevSoundToneMaxVolumeWhilePlayingTest(const TDesC& aTestName)
  1.3991 +	:	RA3FDevSoundTestBase(aTestName), iDuration(0),
  1.3992 +		iFrequencyTone1(0), iExVolume(0)
  1.3993 +	{
  1.3994 +	}
  1.3995 +
  1.3996 +RA3FDevSoundToneMaxVolumeWhilePlayingTest* RA3FDevSoundToneMaxVolumeWhilePlayingTest::NewL(const TDesC& aTestName)
  1.3997 +	{
  1.3998 +	RA3FDevSoundToneMaxVolumeWhilePlayingTest * self = new(ELeave)RA3FDevSoundToneMaxVolumeWhilePlayingTest(aTestName);
  1.3999 +	return self;
  1.4000 +	}
  1.4001 +
  1.4002 +void RA3FDevSoundToneMaxVolumeWhilePlayingTest::DoKickoffTestL()
  1.4003 +	{
  1.4004 +	if (!GetIntFromConfig(iTestStepName, KExVolume, iExVolume))
  1.4005 +		{
  1.4006 +		ERR_PRINTF2(KMsgErrorGetParameter, &KExVolume);
  1.4007 +		StopTest(KErrNotFound);
  1.4008 +		return;
  1.4009 +		}
  1.4010 +	if (!GetIntFromConfig(iTestStepName, KDuration, iDuration))
  1.4011 +		{
  1.4012 +		ERR_PRINTF2(KMsgErrorGetParameter, &KDuration);
  1.4013 +		StopTest(KErrNotFound);
  1.4014 +		return;
  1.4015 +		}
  1.4016 +	if (!GetIntFromConfig(iTestStepName, KFrequencyTone1, iFrequencyTone1))
  1.4017 +		{
  1.4018 +		ERR_PRINTF2(KMsgErrorGetParameter, &KFrequencyTone1);
  1.4019 +		StopTest(KErrNotFound);
  1.4020 +		return;
  1.4021 +		}
  1.4022 +	iTimer = CPeriodic::NewL(CActive::EPriorityHigh);
  1.4023 +	}
  1.4024 +
  1.4025 +void RA3FDevSoundToneMaxVolumeWhilePlayingTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError)
  1.4026 +	{
  1.4027 +	switch (iDevSoundState)
  1.4028 +		{
  1.4029 +		case EStateCreated:
  1.4030 +			{
  1.4031 +			__ASSERT_ALWAYS((aError == KErrNone), Panic(_L("RA3FDevSoundToneMaxVolumeWhilePlayingTest"), EFsmIncorrectErrorPassed));
  1.4032 +			if (aDevSoundEvent == EEventInitialize)
  1.4033 +				{
  1.4034 +				INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL"));
  1.4035 +				TRAPD(err, iMMFDevSound->InitializeL(*this, EMMFStateTonePlaying));
  1.4036 +				if (err != KErrNone)
  1.4037 +					{
  1.4038 +					ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err);
  1.4039 +					StopTest(err);
  1.4040 +					break;
  1.4041 +					}
  1.4042 +				INFO_PRINTF1(_L("DevSound State: EStateInitializing"));
  1.4043 +				iDevSoundState = EStateInitializing;
  1.4044 +				}
  1.4045 +			else
  1.4046 +				{
  1.4047 +				ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent);
  1.4048 +				StopTest(aError, EFail);
  1.4049 +				}
  1.4050 +			break;
  1.4051 +			}
  1.4052 +		case EStateInitializing:
  1.4053 +			{
  1.4054 +			if (aDevSoundEvent == EEventInitComplete && aError == KErrNone)
  1.4055 +				{
  1.4056 +				iMMFDevSound->SetVolume(iMMFDevSound->MaxVolume());
  1.4057 +				iStartTime.HomeTime();
  1.4058 +				INFO_PRINTF3(_L("Calling CMMFDevSound::PlayToneL using %d Hz during %d secs "), iFrequencyTone1, iDuration);
  1.4059 +				TRAPD(err, iMMFDevSound->PlayToneL(iFrequencyTone1, iDuration*KMicroSecsInOneSec));
  1.4060 +				if (err != KErrNone)
  1.4061 +					{
  1.4062 +					ERR_PRINTF2(_L("CMMFDevSound::PlayToneL left with error : %d!"),  err);
  1.4063 +					StopTest(err);
  1.4064 +					break;
  1.4065 +					}
  1.4066 +				StartTimer(KMicroSecsTwoSec);
  1.4067 +				INFO_PRINTF1(_L("DevSound State: EStatePlaying"));
  1.4068 +				iDevSoundState = EStatePlaying;
  1.4069 +				}
  1.4070 +			else if (aDevSoundEvent == EEventInitComplete && aError != KErrNone)
  1.4071 +				{
  1.4072 +				ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error = %d"), aError);
  1.4073 +				StopTest(aError);
  1.4074 +				}
  1.4075 +			else
  1.4076 +				{
  1.4077 +				ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent);
  1.4078 +				StopTest(aError, EFail);
  1.4079 +				}
  1.4080 +			break;
  1.4081 +			}
  1.4082 +		default:
  1.4083 +			{
  1.4084 +			ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState);
  1.4085 +			StopTest(aError, EFail);
  1.4086 +			}
  1.4087 +		}
  1.4088 +	}
  1.4089 +
  1.4090 +void RA3FDevSoundToneMaxVolumeWhilePlayingTest::DoTimerCallback()
  1.4091 +	{
  1.4092 +	iTimer->Cancel();
  1.4093 +	INFO_PRINTF1(_L("DevSound Event: EEventTimerComplete"));
  1.4094 +	INFO_PRINTF1(_L("Calling CMMFDevSound::MaxVolume"));
  1.4095 +	TInt maxVolumeGet = iMMFDevSound->MaxVolume();
  1.4096 +	if (maxVolumeGet == iExVolume)
  1.4097 +		{
  1.4098 +		INFO_PRINTF2(_L("The max device supported volume is %d."), maxVolumeGet);
  1.4099 +		}
  1.4100 +	else
  1.4101 +		{
  1.4102 +		INFO_PRINTF2(_L("The max device supported volume failed with %d."), maxVolumeGet);
  1.4103 +		ERR_PRINTF2(_L("Expected value = %d."), iExVolume);
  1.4104 +		StopTest(KErrNone, EFail);
  1.4105 +		}
  1.4106 +	}
  1.4107 +
  1.4108 +void RA3FDevSoundToneMaxVolumeWhilePlayingTest::ToneFinished(TInt aError)
  1.4109 +	{
  1.4110 +	INFO_PRINTF1(_L("========== DevSound ToneFinished() callback =========="));
  1.4111 +	if (aError == KErrUnderflow)
  1.4112 +		{
  1.4113 +		iEndTime.HomeTime();
  1.4114 +		iPlayToneTime = iEndTime.MicroSecondsFrom(iStartTime);
  1.4115 +		TInt totalExpectedReproductionTime = iDuration * KMicroSecsInOneSec;
  1.4116 +		if(iPlayToneTime < totalExpectedReproductionTime + KPlayVarianceTime && iPlayToneTime > totalExpectedReproductionTime - KPlayVarianceTime)
  1.4117 +			{
  1.4118 +			INFO_PRINTF2(_L("Play time is %Ld microseconds"), iPlayToneTime.Int64());
  1.4119 +			StopTest();
  1.4120 +			}
  1.4121 +		else
  1.4122 +			{
  1.4123 +			ERR_PRINTF3(_L("Play time is %Ld microseconds and it should have been %d microseconds"), iPlayToneTime.Int64(), totalExpectedReproductionTime);
  1.4124 +			StopTest(KErrNone, EFail);
  1.4125 +			}
  1.4126 +		}
  1.4127 +	else
  1.4128 +		{
  1.4129 +		ERR_PRINTF2(_L("DevSound called ToneFinished with error = %d"), aError);
  1.4130 +		ERR_PRINTF2(_L("Expected error = %d"), KErrUnderflow);
  1.4131 +		StopTest(aError, EFail);
  1.4132 +		}
  1.4133 +	}
  1.4134 +
  1.4135 +/*
  1.4136 + *========================================================================================================
  1.4137 + * MM-A3F-DEVSOUND-CHRTZ-TONE-0031
  1.4138 + */
  1.4139 +RA3FDevSoundToneVolumeWhilePlayingTest::RA3FDevSoundToneVolumeWhilePlayingTest(const TDesC& aTestName)
  1.4140 +	:	RA3FDevSoundTestBase(aTestName), iDuration(0),
  1.4141 +		iFrequencyTone1(0), iExVolume(0)
  1.4142 +	{
  1.4143 +	}
  1.4144 +
  1.4145 +RA3FDevSoundToneVolumeWhilePlayingTest* RA3FDevSoundToneVolumeWhilePlayingTest::NewL(const TDesC& aTestName)
  1.4146 +	{
  1.4147 +	RA3FDevSoundToneVolumeWhilePlayingTest * self = new(ELeave)RA3FDevSoundToneVolumeWhilePlayingTest(aTestName);
  1.4148 +	return self;
  1.4149 +	}
  1.4150 +
  1.4151 +void RA3FDevSoundToneVolumeWhilePlayingTest::DoKickoffTestL()
  1.4152 +	{
  1.4153 +	if (!GetIntFromConfig(iTestStepName, KExVolume, iExVolume))
  1.4154 +		{
  1.4155 +		ERR_PRINTF2(KMsgErrorGetParameter, &KExVolume);
  1.4156 +		StopTest(KErrNotFound);
  1.4157 +		return;
  1.4158 +		}
  1.4159 +	if (!GetIntFromConfig(iTestStepName, KDuration, iDuration))
  1.4160 +		{
  1.4161 +		ERR_PRINTF2(KMsgErrorGetParameter, &KDuration);
  1.4162 +		StopTest(KErrNotFound);
  1.4163 +		return;
  1.4164 +		}
  1.4165 +	if (!GetIntFromConfig(iTestStepName, KFrequencyTone1, iFrequencyTone1))
  1.4166 +		{
  1.4167 +		ERR_PRINTF2(KMsgErrorGetParameter, &KFrequencyTone1);
  1.4168 +		StopTest(KErrNotFound);
  1.4169 +		return;
  1.4170 +		}
  1.4171 +	iTimer = CPeriodic::NewL(CActive::EPriorityHigh);
  1.4172 +	}
  1.4173 +
  1.4174 +void RA3FDevSoundToneVolumeWhilePlayingTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError)
  1.4175 +	{
  1.4176 +	switch (iDevSoundState)
  1.4177 +		{
  1.4178 +		case EStateCreated:
  1.4179 +			{
  1.4180 +			__ASSERT_ALWAYS((aError == KErrNone), Panic(_L("RA3FDevSoundToneVolumeWhilePlayingTest"), EFsmIncorrectErrorPassed));
  1.4181 +			if (aDevSoundEvent == EEventInitialize)
  1.4182 +				{
  1.4183 +				INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL"));
  1.4184 +				TRAPD(err, iMMFDevSound->InitializeL(*this, EMMFStateTonePlaying));
  1.4185 +				if (err != KErrNone)
  1.4186 +					{
  1.4187 +					ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err);
  1.4188 +					StopTest(err);
  1.4189 +					break;
  1.4190 +					}
  1.4191 +				INFO_PRINTF1(_L("DevSound State: EStateInitializing"));
  1.4192 +				iDevSoundState = EStateInitializing;
  1.4193 +				}
  1.4194 +			else
  1.4195 +				{
  1.4196 +				ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent);
  1.4197 +				StopTest(aError, EFail);
  1.4198 +				}
  1.4199 +			break;
  1.4200 +			}
  1.4201 +		case EStateInitializing:
  1.4202 +			{
  1.4203 +			if (aDevSoundEvent == EEventInitComplete && aError == KErrNone)
  1.4204 +				{
  1.4205 +				iStartTime.HomeTime();
  1.4206 +				INFO_PRINTF3(_L("Calling CMMFDevSound::PlayToneL using %d Hz during %d secs "), iFrequencyTone1, iDuration);
  1.4207 +				TRAPD(err, iMMFDevSound->PlayToneL(iFrequencyTone1, iDuration*KMicroSecsInOneSec));
  1.4208 +				if (err != KErrNone)
  1.4209 +					{
  1.4210 +					ERR_PRINTF2(_L("CMMFDevSound::PlayToneL left with error : %d!"), err);
  1.4211 +					StopTest(err);
  1.4212 +					break;
  1.4213 +					}
  1.4214 +				StartTimer(KMicroSecsTwoSec);
  1.4215 +				INFO_PRINTF1(_L("DevSound State: EStatePlaying"));
  1.4216 +				iDevSoundState = EStatePlaying;
  1.4217 +				}
  1.4218 +			else if (aDevSoundEvent == EEventInitComplete && aError != KErrNone)
  1.4219 +				{
  1.4220 +				ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error = %d"), aError);
  1.4221 +				StopTest(aError);
  1.4222 +				}
  1.4223 +			else
  1.4224 +				{
  1.4225 +				ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent);
  1.4226 +				StopTest(aError, EFail);
  1.4227 +				}
  1.4228 +			break;
  1.4229 +			}
  1.4230 +		default:
  1.4231 +			{
  1.4232 +			ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState);
  1.4233 +			StopTest(aError, EFail);
  1.4234 +			}
  1.4235 +		}
  1.4236 +	}
  1.4237 +
  1.4238 +void RA3FDevSoundToneVolumeWhilePlayingTest::DoTimerCallback()
  1.4239 +	{
  1.4240 +	iTimer->Cancel();
  1.4241 +	INFO_PRINTF1(_L("DevSound Event: EEventTimerComplete"));
  1.4242 +	INFO_PRINTF1(_L("Calling CMMFDevSound::Volume"));
  1.4243 +	TInt maxVolumeGet = iMMFDevSound->Volume();
  1.4244 +	if (maxVolumeGet == iExVolume)
  1.4245 +		{
  1.4246 +		INFO_PRINTF2(_L("The device default supported volume value is %d."), maxVolumeGet);
  1.4247 +		}
  1.4248 +	else
  1.4249 +		{
  1.4250 +		INFO_PRINTF2(_L("The device default supported volume value failed with %d."), maxVolumeGet);
  1.4251 +		ERR_PRINTF2(_L("Expected value = %d."), iExVolume);
  1.4252 +		StopTest(KErrNone, EFail);
  1.4253 +		}
  1.4254 +	}
  1.4255 +
  1.4256 +void RA3FDevSoundToneVolumeWhilePlayingTest::ToneFinished(TInt aError)
  1.4257 +	{
  1.4258 +	INFO_PRINTF1(_L("========== DevSound ToneFinished() callback =========="));
  1.4259 +	if (aError == KErrUnderflow)
  1.4260 +		{
  1.4261 +		iEndTime.HomeTime();
  1.4262 +		iPlayToneTime = iEndTime.MicroSecondsFrom(iStartTime);
  1.4263 +		TInt totalExpectedReproductionTime = iDuration * KMicroSecsInOneSec;
  1.4264 +		if(iPlayToneTime < totalExpectedReproductionTime + KPlayVarianceTime && iPlayToneTime > totalExpectedReproductionTime - KPlayVarianceTime)
  1.4265 +			{
  1.4266 +			INFO_PRINTF2(_L("Play time is %Ld microseconds"), iPlayToneTime.Int64());
  1.4267 +			StopTest();
  1.4268 +			}
  1.4269 +		else
  1.4270 +			{
  1.4271 +			ERR_PRINTF3(_L("Play time is %Ld microseconds and it should have been %d microseconds"), iPlayToneTime.Int64(), totalExpectedReproductionTime);
  1.4272 +			StopTest(KErrNone, EFail);
  1.4273 +			}
  1.4274 +		}
  1.4275 +	else
  1.4276 +		{
  1.4277 +		ERR_PRINTF2(_L("DevSound called ToneFinished with error = %d"), aError);
  1.4278 +		ERR_PRINTF2(_L("Expected error = %d"), KErrUnderflow);
  1.4279 +		StopTest(aError, EFail);
  1.4280 +		}
  1.4281 +	}
  1.4282 +
  1.4283 +/*
  1.4284 + *========================================================================================================
  1.4285 + * MM-A3F-DEVSOUND-CHRTZ-TONE-0032
  1.4286 + */
  1.4287 +RA3FDevSoundToneQueryCapsWhilePausePlayingTest::RA3FDevSoundToneQueryCapsWhilePausePlayingTest(const TDesC& aTestName)
  1.4288 +	:	RA3FDevSoundTestBase(aTestName), iDuration(0),
  1.4289 +		iFrequencyTone1(0), iExCapRate(0), iExCapChannels(0),
  1.4290 +		iTimeToEnterPauseElapsed(EFalse)
  1.4291 +	{
  1.4292 +	}
  1.4293 +
  1.4294 +RA3FDevSoundToneQueryCapsWhilePausePlayingTest* RA3FDevSoundToneQueryCapsWhilePausePlayingTest::NewL(const TDesC& aTestName)
  1.4295 +	{
  1.4296 +	RA3FDevSoundToneQueryCapsWhilePausePlayingTest * self = new(ELeave)RA3FDevSoundToneQueryCapsWhilePausePlayingTest(aTestName);
  1.4297 +	return self;
  1.4298 +	}
  1.4299 +
  1.4300 +void RA3FDevSoundToneQueryCapsWhilePausePlayingTest::DoKickoffTestL()
  1.4301 +	{
  1.4302 +	if (!GetIntFromConfig(iTestStepName, KDuration, iDuration))
  1.4303 +		{
  1.4304 +		ERR_PRINTF2(KMsgErrorGetParameter, &KDuration);
  1.4305 +		StopTest(KErrNotFound);
  1.4306 +		return;
  1.4307 +		}
  1.4308 +	if (!GetIntFromConfig(iTestStepName, KFrequencyTone1, iFrequencyTone1))
  1.4309 +		{
  1.4310 +		ERR_PRINTF2(KMsgErrorGetParameter, &KFrequencyTone1);
  1.4311 +		StopTest(KErrNotFound);
  1.4312 +		return;
  1.4313 +		}
  1.4314 +	if (!GetIntFromConfig(iTestStepName, KExCapRate, iExCapRate))
  1.4315 +		{
  1.4316 +		ERR_PRINTF2(KMsgErrorGetParameter, &KSampleRate);
  1.4317 +		StopTest(KErrNotFound);
  1.4318 +		return;
  1.4319 +		}
  1.4320 +	if (!GetIntFromConfig(iTestStepName, KExCapChannels, iExCapChannels))
  1.4321 +		{
  1.4322 +		ERR_PRINTF2(KMsgErrorGetParameter, &KChannel);
  1.4323 +		StopTest(KErrNotFound);
  1.4324 +		return;
  1.4325 +		}
  1.4326 +	iTimer = CPeriodic::NewL(CActive::EPriorityHigh);
  1.4327 +	}
  1.4328 +
  1.4329 +void RA3FDevSoundToneQueryCapsWhilePausePlayingTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError)
  1.4330 +	{
  1.4331 +	switch (iDevSoundState)
  1.4332 +		{
  1.4333 +		case EStateCreated:
  1.4334 +			{
  1.4335 +			__ASSERT_ALWAYS((aError == KErrNone), Panic(_L("RA3FDevSoundToneQueryCapsWhilePausePlayingTest"), EFsmIncorrectErrorPassed));
  1.4336 +			if (aDevSoundEvent == EEventInitialize)
  1.4337 +				{
  1.4338 +				INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL"));
  1.4339 +				TRAPD(err, iMMFDevSound->InitializeL(*this, EMMFStateTonePlaying));
  1.4340 +				if (err != KErrNone)
  1.4341 +					{
  1.4342 +					ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err);
  1.4343 +					StopTest(err);
  1.4344 +					break;
  1.4345 +					}
  1.4346 +				INFO_PRINTF1(_L("DevSound State: EStateInitializing"));
  1.4347 +				iDevSoundState = EStateInitializing;
  1.4348 +				}
  1.4349 +			else
  1.4350 +				{
  1.4351 +				ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent);
  1.4352 +				StopTest(aError, EFail);
  1.4353 +				}
  1.4354 +			break;
  1.4355 +			}
  1.4356 +		case EStateInitializing:
  1.4357 +			{
  1.4358 +			if (aDevSoundEvent == EEventInitComplete && aError == KErrNone)
  1.4359 +				{
  1.4360 +				iMMFDevSound->SetVolume(iMMFDevSound->MaxVolume());
  1.4361 +				INFO_PRINTF3(_L("Calling CMMFDevSound::PlayToneL using %d Hz during %d secs "), iFrequencyTone1, iDuration);
  1.4362 +				TRAPD(err, iMMFDevSound->PlayToneL(iFrequencyTone1, iDuration*KMicroSecsInOneSec));
  1.4363 +				if (err != KErrNone)
  1.4364 +					{
  1.4365 +					ERR_PRINTF2(_L("CMMFDevSound::PlayToneL left with error : %d!"), err);
  1.4366 +					StopTest(err);
  1.4367 +					break;
  1.4368 +					}
  1.4369 +				StartTimer(KMicroSecsTwoSec);
  1.4370 +				INFO_PRINTF1(_L("DevSound State: EStatePlaying"));
  1.4371 +				iDevSoundState = EStatePlaying;
  1.4372 +				}
  1.4373 +			else if (aDevSoundEvent == EEventInitComplete && aError != KErrNone)
  1.4374 +				{
  1.4375 +				ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error = %d"), aError);
  1.4376 +				StopTest(aError);
  1.4377 +				}
  1.4378 +			else
  1.4379 +				{
  1.4380 +				ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent);
  1.4381 +				StopTest(aError, EFail);
  1.4382 +				}
  1.4383 +			break;
  1.4384 +			}
  1.4385 +		case EStatePlaying:
  1.4386 +			{
  1.4387 +			if(aDevSoundEvent == EEventTimerComplete)
  1.4388 +				{
  1.4389 +				INFO_PRINTF1(_L("Calling CMMFDevSound::Pause"));
  1.4390 +				iMMFDevSound->Pause();
  1.4391 +				INFO_PRINTF1(_L("DevSound State: EStatePause"));
  1.4392 +				iDevSoundState = EStatePause;
  1.4393 +				}
  1.4394 +			else
  1.4395 +				{
  1.4396 +				ERR_PRINTF2(_L("DevSound EEventTimerComplete not received as expected. Received event: %d"), aDevSoundEvent);
  1.4397 +				StopTest(aError, EFail);
  1.4398 +				}
  1.4399 +			break;
  1.4400 +			}
  1.4401 +		case EStatePause:
  1.4402 +			{
  1.4403 +			if(aDevSoundEvent == EEventTimerComplete)
  1.4404 +				{
  1.4405 +				TMMFCapabilities capabilities;
  1.4406 +				INFO_PRINTF1(_L("Calling CMMFDevSound::Capabilities"));
  1.4407 +				capabilities = iMMFDevSound->Capabilities();
  1.4408 +				PrintSupportedCapabilities(capabilities.iRate, capabilities.iChannels);
  1.4409 +				if(capabilities.iRate == iExCapRate)
  1.4410 +					{
  1.4411 +					INFO_PRINTF2(_L("The total of possible sample rate values is 0x%08x"), capabilities.iRate);
  1.4412 +					if(capabilities.iChannels == iExCapChannels)
  1.4413 +						{
  1.4414 +						INFO_PRINTF2(_L("The total of possible channel values is 0x%08x"),capabilities.iChannels );
  1.4415 +						StopTest();
  1.4416 +						}
  1.4417 +					else
  1.4418 +						{
  1.4419 +						ERR_PRINTF2(_L("The total of possible channel values failed with 0x%08x"), capabilities.iChannels );
  1.4420 +						ERR_PRINTF2(_L("Expected value = %d"), iExCapChannels);
  1.4421 +						StopTest(aError, EFail);
  1.4422 +						}
  1.4423 +					}
  1.4424 +				else
  1.4425 +					{
  1.4426 +					ERR_PRINTF2(_L("The total of possible sample rate values failed with 0x%08x"), capabilities.iRate);
  1.4427 +					ERR_PRINTF2(_L("Expected value = %d"), iExCapRate);
  1.4428 +					StopTest(aError, EFail);
  1.4429 +					}
  1.4430 +				}
  1.4431 +			else
  1.4432 +				{
  1.4433 +				ERR_PRINTF2(_L("DevSound EEventTimerComplete not received as expected. Received event: %d"), aDevSoundEvent);
  1.4434 +				StopTest(aError, EFail);
  1.4435 +				}
  1.4436 +			break;
  1.4437 +			}
  1.4438 +		default:
  1.4439 +			{
  1.4440 +			ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState);
  1.4441 +			StopTest(aError, EFail);
  1.4442 +			}
  1.4443 +		}
  1.4444 +	}
  1.4445 +
  1.4446 +void RA3FDevSoundToneQueryCapsWhilePausePlayingTest::DoTimerCallback()
  1.4447 +	{
  1.4448 +	INFO_PRINTF1(_L("TimerEvent called"));
  1.4449 +	if(!iTimeToEnterPauseElapsed)
  1.4450 +		{
  1.4451 +		iTimeToEnterPauseElapsed = ETrue;
  1.4452 +		INFO_PRINTF1(_L("DevSound Event: EEventTimerComplete"));
  1.4453 +		Fsm(EEventTimerComplete, KErrNone);
  1.4454 +		iTimeToEnterPauseElapsed = ETrue;
  1.4455 +		}
  1.4456 +	else
  1.4457 +		{
  1.4458 +		iTimer->Cancel();
  1.4459 +		INFO_PRINTF1(_L("DevSound Event: EEventTimerComplete"));
  1.4460 +		Fsm(EEventTimerComplete, KErrNone);
  1.4461 +		}
  1.4462 +	}
  1.4463 +
  1.4464 +void RA3FDevSoundToneQueryCapsWhilePausePlayingTest::ToneFinished(TInt aError)
  1.4465 +	{
  1.4466 +	INFO_PRINTF1(_L("========== DevSound ToneFinished() callback =========="));
  1.4467 +	ERR_PRINTF1(_L("DevSound should not have called ToneFinished because it is supposed to be paused then stopped"));
  1.4468 +	StopTest(aError, EFail);
  1.4469 +	}
  1.4470 +
  1.4471 +
  1.4472 +/*
  1.4473 + *========================================================================================================
  1.4474 + * MM-A3F-DEVSOUND-CHRTZ-TONE-0033
  1.4475 + */
  1.4476 +RA3FDevSoundToneConfigWhilePausePlayingTest::RA3FDevSoundToneConfigWhilePausePlayingTest(const TDesC& aTestName)
  1.4477 +	:	RA3FDevSoundTestBase(aTestName), iDuration(0),
  1.4478 +		iFrequencyTone1(0), iTimeToEnterPauseElapsed(EFalse),
  1.4479 +		iExCapRate(0), iExCapChannels(0)
  1.4480 +	{
  1.4481 +	}
  1.4482 +
  1.4483 +RA3FDevSoundToneConfigWhilePausePlayingTest* RA3FDevSoundToneConfigWhilePausePlayingTest::NewL(const TDesC& aTestName)
  1.4484 +	{
  1.4485 +	RA3FDevSoundToneConfigWhilePausePlayingTest * self = new(ELeave)RA3FDevSoundToneConfigWhilePausePlayingTest(aTestName);
  1.4486 +	return self;
  1.4487 +	}
  1.4488 +
  1.4489 +void RA3FDevSoundToneConfigWhilePausePlayingTest::DoKickoffTestL()
  1.4490 +	{
  1.4491 +	if (!GetIntFromConfig(iTestStepName, KDuration, iDuration))
  1.4492 +		{
  1.4493 +		ERR_PRINTF2(KMsgErrorGetParameter, &KDuration);
  1.4494 +		StopTest(KErrNotFound);
  1.4495 +		return;
  1.4496 +		}
  1.4497 +	if (!GetIntFromConfig(iTestStepName, KFrequencyTone1, iFrequencyTone1))
  1.4498 +		{
  1.4499 +		ERR_PRINTF2(KMsgErrorGetParameter, &KFrequencyTone1);
  1.4500 +		StopTest(KErrNotFound);
  1.4501 +		return;
  1.4502 +		}
  1.4503 +	if (!GetIntFromConfig(iTestStepName, KExCapRate, iExCapRate))
  1.4504 +			{
  1.4505 +			ERR_PRINTF2(KMsgErrorGetParameter, &KExCapRate);
  1.4506 +			StopTest(KErrNotFound);
  1.4507 +			return;
  1.4508 +			}
  1.4509 +	if (!GetIntFromConfig(iTestStepName, KExCapChannels, iExCapChannels))
  1.4510 +		{
  1.4511 +		ERR_PRINTF2(KMsgErrorGetParameter, &KExCapChannels);
  1.4512 +		StopTest(KErrNotFound);
  1.4513 +		return;
  1.4514 +		}
  1.4515 +	iTimer = CPeriodic::NewL(CActive::EPriorityHigh);
  1.4516 +	}
  1.4517 +
  1.4518 +void RA3FDevSoundToneConfigWhilePausePlayingTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError)
  1.4519 +	{
  1.4520 +	switch (iDevSoundState)
  1.4521 +		{
  1.4522 +		case EStateCreated:
  1.4523 +			{
  1.4524 +			__ASSERT_ALWAYS((aError == KErrNone), Panic(_L("RA3FDevSoundToneConfigWhilePausePlayingTest"), EFsmIncorrectErrorPassed));
  1.4525 +			if (aDevSoundEvent == EEventInitialize)
  1.4526 +				{
  1.4527 +				INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL"));
  1.4528 +				TRAPD(err, iMMFDevSound->InitializeL(*this, EMMFStateTonePlaying));
  1.4529 +				if (err != KErrNone)
  1.4530 +					{
  1.4531 +					ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err);
  1.4532 +					StopTest(err);
  1.4533 +					break;
  1.4534 +					}
  1.4535 +				INFO_PRINTF1(_L("DevSound State: EStateInitializing"));
  1.4536 +				iDevSoundState = EStateInitializing;
  1.4537 +				}
  1.4538 +			else
  1.4539 +				{
  1.4540 +				ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent);
  1.4541 +				StopTest(aError, EFail);
  1.4542 +				}
  1.4543 +			break;
  1.4544 +			}
  1.4545 +		case EStateInitializing:
  1.4546 +			{
  1.4547 +			if (aDevSoundEvent == EEventInitComplete && aError == KErrNone)
  1.4548 +				{
  1.4549 +				iMMFDevSound->SetVolume(iMMFDevSound->MaxVolume());
  1.4550 +				INFO_PRINTF3(_L("Calling CMMFDevSound::PlayToneL using %d Hz during %d secs "), iFrequencyTone1, iDuration);
  1.4551 +				TRAPD(err, iMMFDevSound->PlayToneL(iFrequencyTone1, iDuration*KMicroSecsInOneSec));
  1.4552 +				if (err != KErrNone)
  1.4553 +					{
  1.4554 +					ERR_PRINTF2(_L("CMMFDevSound::PlayToneL left with error : %d!"), err);
  1.4555 +					StopTest(err);
  1.4556 +					break;
  1.4557 +					}
  1.4558 +				StartTimer(KMicroSecsTwoSec);
  1.4559 +				INFO_PRINTF1(_L("DevSound State: EStatePlaying"));
  1.4560 +				iDevSoundState = EStatePlaying;
  1.4561 +				}
  1.4562 +			else if (aDevSoundEvent == EEventInitComplete && aError != KErrNone)
  1.4563 +				{
  1.4564 +				ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error = %d"), aError);
  1.4565 +				StopTest(aError);
  1.4566 +				}
  1.4567 +			else
  1.4568 +				{
  1.4569 +				ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent);
  1.4570 +				StopTest(aError, EFail);
  1.4571 +				}
  1.4572 +			break;
  1.4573 +			}
  1.4574 +		case EStatePlaying:
  1.4575 +			{
  1.4576 +			if(aDevSoundEvent == EEventTimerComplete)
  1.4577 +				{
  1.4578 +				INFO_PRINTF1(_L("Calling CMMFDevSound::Pause"));
  1.4579 +				iMMFDevSound->Pause();
  1.4580 +				INFO_PRINTF1(_L("DevSound State: EStatePause"));
  1.4581 +				iDevSoundState = EStatePause;
  1.4582 +				}
  1.4583 +			else
  1.4584 +				{
  1.4585 +				ERR_PRINTF2(_L("DevSound EEventTimerComplete not received as expected. Received event: %d"), aDevSoundEvent);
  1.4586 +				StopTest(aError, EFail);
  1.4587 +				}
  1.4588 +			break;
  1.4589 +			}
  1.4590 +		case EStatePause:
  1.4591 +			{
  1.4592 +			if(aDevSoundEvent == EEventTimerComplete)
  1.4593 +				{
  1.4594 +				TMMFCapabilities capabilitiesGet;
  1.4595 +				TBuf<KMaxSampleRateStringLength> stringSampleRateGet;
  1.4596 +				TBuf<KMaxChannelsStringLength> stringChannelsGet;
  1.4597 +				TBuf<KMaxSampleRateStringLength> stringSampleRateExpected;
  1.4598 +				TBuf<KMaxChannelsStringLength> stringChannelsExpected;
  1.4599 +				INFO_PRINTF1(_L("Calling CMMFDevSound::Config while playing"));
  1.4600 +				capabilitiesGet=iMMFDevSound->Config();
  1.4601 +				SampleRateFromTUintToString (capabilitiesGet.iRate, stringSampleRateGet);
  1.4602 +				ChannelsFromTUintToString (capabilitiesGet.iChannels, stringChannelsGet);
  1.4603 +				SampleRateFromTIntToTMMFSampleRate (iExCapRate, iExSampleRate);
  1.4604 +				SampleRateFromTUintToString (iExSampleRate, stringSampleRateExpected);
  1.4605 +				ChannelsFromTUintToString (iExCapChannels, stringChannelsExpected);
  1.4606 +				if (stringSampleRateExpected.Compare(stringSampleRateGet) == 0)
  1.4607 +					{
  1.4608 +					INFO_PRINTF2(_L("Sample rate value match default as expected with %S"), &stringSampleRateGet);
  1.4609 +					if (stringChannelsExpected.Compare(stringChannelsGet) == 0)
  1.4610 +						{
  1.4611 +						INFO_PRINTF2(_L("Channel mode value match default as expected with %S"), &stringChannelsGet);
  1.4612 +						StopTest();
  1.4613 +						}
  1.4614 +					else
  1.4615 +						{
  1.4616 +						INFO_PRINTF2(_L("Channel mode value failed with %S"), &stringChannelsGet);
  1.4617 +						ERR_PRINTF2(_L("Expected channel mode %S"), &stringChannelsExpected);
  1.4618 +						StopTest(aError, EFail);
  1.4619 +						}
  1.4620 +					}
  1.4621 +				else
  1.4622 +					{
  1.4623 +					ERR_PRINTF2(_L("Sample rate value failed with %S"), &stringSampleRateGet);
  1.4624 +					ERR_PRINTF2(_L("Expected sample rate %S"), &stringSampleRateExpected);
  1.4625 +					StopTest(aError, EFail);
  1.4626 +					}
  1.4627 +				}
  1.4628 +			else
  1.4629 +				{
  1.4630 +				ERR_PRINTF2(_L("DevSound EEventTimerComplete not received as expected. Received event: %d"), aDevSoundEvent);
  1.4631 +				StopTest(aError, EFail);
  1.4632 +				}
  1.4633 +			break;
  1.4634 +			}
  1.4635 +		default:
  1.4636 +			{
  1.4637 +			ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState);
  1.4638 +			StopTest(aError, EFail);
  1.4639 +			}
  1.4640 +		}
  1.4641 +	}
  1.4642 +
  1.4643 +void RA3FDevSoundToneConfigWhilePausePlayingTest::DoTimerCallback()
  1.4644 +	{
  1.4645 +	INFO_PRINTF1(_L("TimerEvent called"));
  1.4646 +	if(!iTimeToEnterPauseElapsed)
  1.4647 +		{
  1.4648 +		iTimeToEnterPauseElapsed = ETrue;
  1.4649 +		INFO_PRINTF1(_L("DevSound Event: EEventTimerComplete"));
  1.4650 +		Fsm(EEventTimerComplete, KErrNone);
  1.4651 +		iTimeToEnterPauseElapsed = ETrue;
  1.4652 +		}
  1.4653 +	else
  1.4654 +		{
  1.4655 +		iTimer->Cancel();
  1.4656 +		INFO_PRINTF1(_L("DevSound Event: EEventTimerComplete"));
  1.4657 +		Fsm(EEventTimerComplete, KErrNone);
  1.4658 +		}
  1.4659 +	}
  1.4660 +
  1.4661 +void RA3FDevSoundToneConfigWhilePausePlayingTest::ToneFinished(TInt aError)
  1.4662 +	{
  1.4663 +	INFO_PRINTF1(_L("========== DevSound ToneFinished() callback =========="));
  1.4664 +	ERR_PRINTF1(_L("DevSound should not have called ToneFinished because it is supposed to be paused then stopped"));
  1.4665 +	StopTest(aError, EFail);
  1.4666 +	}
  1.4667 +
  1.4668 +
  1.4669 +/*
  1.4670 + *========================================================================================================
  1.4671 + * MM-A3F-DEVSOUND-CHRTZ-TONE-0034
  1.4672 + */
  1.4673 +RA3FDevSoundToneMaxVolumeWhilePausePlayingTest::RA3FDevSoundToneMaxVolumeWhilePausePlayingTest(const TDesC& aTestName)
  1.4674 +	:	RA3FDevSoundTestBase(aTestName), iDuration(0),
  1.4675 +		iFrequencyTone1(0), iExVolume(0),
  1.4676 +		iTimeToEnterPauseElapsed(EFalse)
  1.4677 +	{
  1.4678 +	}
  1.4679 +
  1.4680 +RA3FDevSoundToneMaxVolumeWhilePausePlayingTest* RA3FDevSoundToneMaxVolumeWhilePausePlayingTest::NewL(const TDesC& aTestName)
  1.4681 +	{
  1.4682 +	RA3FDevSoundToneMaxVolumeWhilePausePlayingTest * self = new(ELeave)RA3FDevSoundToneMaxVolumeWhilePausePlayingTest(aTestName);
  1.4683 +	return self;
  1.4684 +	}
  1.4685 +
  1.4686 +void RA3FDevSoundToneMaxVolumeWhilePausePlayingTest::DoKickoffTestL()
  1.4687 +	{
  1.4688 +	if (!GetIntFromConfig(iTestStepName, KDuration, iDuration))
  1.4689 +		{
  1.4690 +		ERR_PRINTF2(KMsgErrorGetParameter, &KDuration);
  1.4691 +		StopTest(KErrNotFound);
  1.4692 +		return;
  1.4693 +		}
  1.4694 +	if (!GetIntFromConfig(iTestStepName, KFrequencyTone1, iFrequencyTone1))
  1.4695 +		{
  1.4696 +		ERR_PRINTF2(KMsgErrorGetParameter, &KFrequencyTone1);
  1.4697 +		StopTest(KErrNotFound);
  1.4698 +		return;
  1.4699 +		}
  1.4700 +	if (!GetIntFromConfig(iTestStepName, KExVolume, iExVolume))
  1.4701 +		{
  1.4702 +		ERR_PRINTF2(KMsgErrorGetParameter, &KExVolume);
  1.4703 +		StopTest(KErrNotFound);
  1.4704 +		return;
  1.4705 +		}
  1.4706 +	iTimer = CPeriodic::NewL(CActive::EPriorityHigh);
  1.4707 +	}
  1.4708 +
  1.4709 +void RA3FDevSoundToneMaxVolumeWhilePausePlayingTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError)
  1.4710 +	{
  1.4711 +	switch (iDevSoundState)
  1.4712 +		{
  1.4713 +		case EStateCreated:
  1.4714 +			{
  1.4715 +			__ASSERT_ALWAYS((aError == KErrNone), Panic(_L("RA3FDevSoundToneMaxVolumeWhilePausePlayingTest"), EFsmIncorrectErrorPassed));
  1.4716 +			if (aDevSoundEvent == EEventInitialize)
  1.4717 +				{
  1.4718 +				INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL"));
  1.4719 +				TRAPD(err, iMMFDevSound->InitializeL(*this, EMMFStateTonePlaying));
  1.4720 +				if (err != KErrNone)
  1.4721 +					{
  1.4722 +					ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err);
  1.4723 +					StopTest(err);
  1.4724 +					break;
  1.4725 +					}
  1.4726 +				INFO_PRINTF1(_L("DevSound State: EStateInitializing"));
  1.4727 +				iDevSoundState = EStateInitializing;
  1.4728 +				}
  1.4729 +			else
  1.4730 +				{
  1.4731 +				ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent);
  1.4732 +				StopTest(aError, EFail);
  1.4733 +				}
  1.4734 +			break;
  1.4735 +			}
  1.4736 +		case EStateInitializing:
  1.4737 +			{
  1.4738 +			if (aDevSoundEvent == EEventInitComplete && aError == KErrNone)
  1.4739 +				{
  1.4740 +				iMMFDevSound->SetVolume(iMMFDevSound->MaxVolume());
  1.4741 +				INFO_PRINTF3(_L("Calling CMMFDevSound::PlayToneL using %d Hz during %d secs "), iFrequencyTone1, iDuration);
  1.4742 +				TRAPD(err, iMMFDevSound->PlayToneL(iFrequencyTone1, iDuration*KMicroSecsInOneSec));
  1.4743 +				if (err != KErrNone)
  1.4744 +					{
  1.4745 +					ERR_PRINTF2(_L("CMMFDevSound::PlayToneL left with error : %d!"), err);
  1.4746 +					StopTest(err);
  1.4747 +					break;
  1.4748 +					}
  1.4749 +				StartTimer(KMicroSecsTwoSec);
  1.4750 +				INFO_PRINTF1(_L("DevSound State: EStatePlaying"));
  1.4751 +				iDevSoundState = EStatePlaying;
  1.4752 +				}
  1.4753 +			else if (aDevSoundEvent == EEventInitComplete && aError != KErrNone)
  1.4754 +				{
  1.4755 +				ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error = %d"), aError);
  1.4756 +				StopTest(aError);
  1.4757 +				}
  1.4758 +			else
  1.4759 +				{
  1.4760 +				ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent);
  1.4761 +				StopTest(aError, EFail);
  1.4762 +				}
  1.4763 +			break;
  1.4764 +			}
  1.4765 +		case EStatePlaying:
  1.4766 +			{
  1.4767 +			if(aDevSoundEvent == EEventTimerComplete)
  1.4768 +				{
  1.4769 +				INFO_PRINTF1(_L("Calling CMMFDevSound::Pause"));
  1.4770 +				iMMFDevSound->Pause();
  1.4771 +				INFO_PRINTF1(_L("DevSound State: EStatePause"));
  1.4772 +				iDevSoundState = EStatePause;
  1.4773 +				}
  1.4774 +			else
  1.4775 +				{
  1.4776 +				ERR_PRINTF2(_L("DevSound EEventTimerComplete not received as expected. Received event: %d"), aDevSoundEvent);
  1.4777 +				StopTest(aError, EFail);
  1.4778 +				}
  1.4779 +			break;
  1.4780 +			}
  1.4781 +		case EStatePause:
  1.4782 +			{
  1.4783 +			if(aDevSoundEvent == EEventTimerComplete)
  1.4784 +				{
  1.4785 +				INFO_PRINTF1(_L("Calling CMMFDevSound::MaxVolume"));
  1.4786 +				TInt maxVolumeGet = iMMFDevSound->MaxVolume();
  1.4787 +				if (maxVolumeGet == iExVolume)
  1.4788 +					{
  1.4789 +					INFO_PRINTF2(_L("The max device supported volume is %d."), maxVolumeGet);
  1.4790 +					StopTest();
  1.4791 +					}
  1.4792 +				else
  1.4793 +					{
  1.4794 +					INFO_PRINTF2(_L("The max device supported volume failed with %d."), maxVolumeGet);
  1.4795 +					ERR_PRINTF2(_L("Expected value = %d."), iExVolume);
  1.4796 +					StopTest(aError, EFail);
  1.4797 +					}
  1.4798 +				}
  1.4799 +			else
  1.4800 +				{
  1.4801 +				ERR_PRINTF2(_L("DevSound EEventTimerComplete not received as expected. Received event: %d"), aDevSoundEvent);
  1.4802 +				StopTest(aError, EFail);
  1.4803 +				}
  1.4804 +			break;
  1.4805 +			}
  1.4806 +		default:
  1.4807 +			{
  1.4808 +			ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState);
  1.4809 +			StopTest(aError, EFail);
  1.4810 +			}
  1.4811 +		}
  1.4812 +	}
  1.4813 +
  1.4814 +void RA3FDevSoundToneMaxVolumeWhilePausePlayingTest::DoTimerCallback()
  1.4815 +	{
  1.4816 +	INFO_PRINTF1(_L("TimerEvent called"));
  1.4817 +	if(!iTimeToEnterPauseElapsed)
  1.4818 +		{
  1.4819 +		iTimeToEnterPauseElapsed = ETrue;
  1.4820 +		INFO_PRINTF1(_L("DevSound Event: EEventTimerComplete"));
  1.4821 +		Fsm(EEventTimerComplete, KErrNone);
  1.4822 +		iTimeToEnterPauseElapsed = ETrue;
  1.4823 +		}
  1.4824 +	else
  1.4825 +		{
  1.4826 +		iTimer->Cancel();
  1.4827 +		INFO_PRINTF1(_L("DevSound Event: EEventTimerComplete"));
  1.4828 +		Fsm(EEventTimerComplete, KErrNone);
  1.4829 +		}
  1.4830 +	}
  1.4831 +
  1.4832 +void RA3FDevSoundToneMaxVolumeWhilePausePlayingTest::ToneFinished(TInt aError)
  1.4833 +	{
  1.4834 +	INFO_PRINTF1(_L("========== DevSound ToneFinished() callback =========="));
  1.4835 +	ERR_PRINTF1(_L("DevSound should not have called ToneFinished because it is supposed to be paused then stopped"));
  1.4836 +	StopTest(aError, EFail);
  1.4837 +	}
  1.4838 +
  1.4839 +/*
  1.4840 + *========================================================================================================
  1.4841 + * MM-A3F-DEVSOUND-CHRTZ-TONE-0035
  1.4842 + */
  1.4843 +RA3FDevSoundToneVolumeWhilePausePlayingTest::RA3FDevSoundToneVolumeWhilePausePlayingTest(const TDesC& aTestName)
  1.4844 +	:	RA3FDevSoundTestBase(aTestName), iDuration(0),
  1.4845 +		iFrequencyTone1(0), iExVolume(0),
  1.4846 +		iTimeToEnterPauseElapsed(EFalse)
  1.4847 +	{
  1.4848 +	}
  1.4849 +
  1.4850 +RA3FDevSoundToneVolumeWhilePausePlayingTest* RA3FDevSoundToneVolumeWhilePausePlayingTest::NewL(const TDesC& aTestName)
  1.4851 +	{
  1.4852 +	RA3FDevSoundToneVolumeWhilePausePlayingTest * self = new(ELeave)RA3FDevSoundToneVolumeWhilePausePlayingTest(aTestName);
  1.4853 +	return self;
  1.4854 +	}
  1.4855 +
  1.4856 +void RA3FDevSoundToneVolumeWhilePausePlayingTest::DoKickoffTestL()
  1.4857 +	{
  1.4858 +	if (!GetIntFromConfig(iTestStepName, KDuration, iDuration))
  1.4859 +		{
  1.4860 +		ERR_PRINTF2(KMsgErrorGetParameter, &KDuration);
  1.4861 +		StopTest(KErrNotFound);
  1.4862 +		return;
  1.4863 +		}
  1.4864 +	if (!GetIntFromConfig(iTestStepName, KFrequencyTone1, iFrequencyTone1))
  1.4865 +		{
  1.4866 +		ERR_PRINTF2(KMsgErrorGetParameter, &KFrequencyTone1);
  1.4867 +		StopTest(KErrNotFound);
  1.4868 +		return;
  1.4869 +		}
  1.4870 +	if (!GetIntFromConfig(iTestStepName, KExVolume, iExVolume))
  1.4871 +		{
  1.4872 +		ERR_PRINTF2(KMsgErrorGetParameter, &KExVolume);
  1.4873 +		StopTest(KErrNotFound);
  1.4874 +		return;
  1.4875 +		}
  1.4876 +	iTimer = CPeriodic::NewL(CActive::EPriorityHigh);
  1.4877 +	}
  1.4878 +
  1.4879 +void RA3FDevSoundToneVolumeWhilePausePlayingTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError)
  1.4880 +	{
  1.4881 +	switch (iDevSoundState)
  1.4882 +		{
  1.4883 +		case EStateCreated:
  1.4884 +			{
  1.4885 +			__ASSERT_ALWAYS((aError == KErrNone), Panic(_L("RA3FDevSoundToneVolumeWhilePausePlayingTest"), EFsmIncorrectErrorPassed));
  1.4886 +			if (aDevSoundEvent == EEventInitialize)
  1.4887 +				{
  1.4888 +				INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL"));
  1.4889 +				TRAPD(err, iMMFDevSound->InitializeL(*this, EMMFStateTonePlaying));
  1.4890 +				if (err != KErrNone)
  1.4891 +					{
  1.4892 +					ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err);
  1.4893 +					StopTest(err);
  1.4894 +					break;
  1.4895 +					}
  1.4896 +				INFO_PRINTF1(_L("DevSound State: EStateInitializing"));
  1.4897 +				iDevSoundState = EStateInitializing;
  1.4898 +				}
  1.4899 +			else
  1.4900 +				{
  1.4901 +				ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent);
  1.4902 +				StopTest(aError, EFail);
  1.4903 +				}
  1.4904 +			break;
  1.4905 +			}
  1.4906 +		case EStateInitializing:
  1.4907 +			{
  1.4908 +			if (aDevSoundEvent == EEventInitComplete && aError == KErrNone)
  1.4909 +				{
  1.4910 +				INFO_PRINTF3(_L("Calling CMMFDevSound::PlayToneL using %d Hz during %d secs "), iFrequencyTone1, iDuration);
  1.4911 +				TRAPD(err, iMMFDevSound->PlayToneL(iFrequencyTone1, iDuration*KMicroSecsInOneSec));
  1.4912 +				if (err != KErrNone)
  1.4913 +					{
  1.4914 +					ERR_PRINTF2(_L("CMMFDevSound::PlayToneL left with error : %d!"), err);
  1.4915 +					StopTest(err);
  1.4916 +					break;
  1.4917 +					}
  1.4918 +				StartTimer(KMicroSecsTwoSec);
  1.4919 +				INFO_PRINTF1(_L("DevSound State: EStatePlaying"));
  1.4920 +				iDevSoundState = EStatePlaying;
  1.4921 +				}
  1.4922 +			else if (aDevSoundEvent == EEventInitComplete && aError != KErrNone)
  1.4923 +				{
  1.4924 +				ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error = %d"), aError);
  1.4925 +				StopTest(aError);
  1.4926 +				}
  1.4927 +			else
  1.4928 +				{
  1.4929 +				ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent);
  1.4930 +				StopTest(aError, EFail);
  1.4931 +				}
  1.4932 +			break;
  1.4933 +			}
  1.4934 +		case EStatePlaying:
  1.4935 +			{
  1.4936 +			if(aDevSoundEvent == EEventTimerComplete)
  1.4937 +				{
  1.4938 +				INFO_PRINTF1(_L("Calling CMMFDevSound::Pause"));
  1.4939 +				iMMFDevSound->Pause();
  1.4940 +				INFO_PRINTF1(_L("DevSound State: EStatePause"));
  1.4941 +				iDevSoundState = EStatePause;
  1.4942 +				}
  1.4943 +			else
  1.4944 +				{
  1.4945 +				ERR_PRINTF2(_L("DevSound EEventTimerComplete not received as expected. Received event: %d"), aDevSoundEvent);
  1.4946 +				StopTest(aError, EFail);
  1.4947 +				}
  1.4948 +			break;
  1.4949 +			}
  1.4950 +		case EStatePause:
  1.4951 +			{
  1.4952 +			if(aDevSoundEvent == EEventTimerComplete)
  1.4953 +				{
  1.4954 +				INFO_PRINTF1(_L("Calling CMMFDevSound::Volume"));
  1.4955 +				TInt maxVolumeGet = iMMFDevSound->Volume();
  1.4956 +				if (maxVolumeGet == iExVolume)
  1.4957 +					{
  1.4958 +					INFO_PRINTF2(_L("The device default supported volume value is %d."), maxVolumeGet);
  1.4959 +					StopTest();
  1.4960 +					}
  1.4961 +				else
  1.4962 +					{
  1.4963 +					INFO_PRINTF2(_L("The device default supported volume value failed with %d."), maxVolumeGet);
  1.4964 +					ERR_PRINTF2(_L("Expected value = %d."), iExVolume);
  1.4965 +					StopTest(aError, EFail);
  1.4966 +					}
  1.4967 +				}
  1.4968 +			else
  1.4969 +				{
  1.4970 +				ERR_PRINTF2(_L("DevSound EEventTimerComplete not received as expected. Received event: %d"), aDevSoundEvent);
  1.4971 +				StopTest(aError, EFail);
  1.4972 +				}
  1.4973 +			break;
  1.4974 +			}
  1.4975 +		default:
  1.4976 +			{
  1.4977 +			ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState);
  1.4978 +			StopTest(aError, EFail);
  1.4979 +			}
  1.4980 +		}
  1.4981 +	}
  1.4982 +
  1.4983 +void RA3FDevSoundToneVolumeWhilePausePlayingTest::DoTimerCallback()
  1.4984 +	{
  1.4985 +	INFO_PRINTF1(_L("TimerEvent called"));
  1.4986 +	if(!iTimeToEnterPauseElapsed)
  1.4987 +		{
  1.4988 +		iTimeToEnterPauseElapsed = ETrue;
  1.4989 +		INFO_PRINTF1(_L("DevSound Event: EEventTimerComplete"));
  1.4990 +		Fsm(EEventTimerComplete, KErrNone);
  1.4991 +		iTimeToEnterPauseElapsed = ETrue;
  1.4992 +		}
  1.4993 +	else
  1.4994 +		{
  1.4995 +		iTimer->Cancel();
  1.4996 +		INFO_PRINTF1(_L("DevSound Event: EEventTimerComplete"));
  1.4997 +		Fsm(EEventTimerComplete, KErrNone);
  1.4998 +		}
  1.4999 +	}
  1.5000 +
  1.5001 +void RA3FDevSoundToneVolumeWhilePausePlayingTest::ToneFinished(TInt aError)
  1.5002 +	{
  1.5003 +	INFO_PRINTF1(_L("========== DevSound ToneFinished() callback =========="));
  1.5004 +	ERR_PRINTF1(_L("DevSound should not have called ToneFinished because it is supposed to be paused then stopped"));
  1.5005 +	StopTest(aError, EFail);
  1.5006 +	}
  1.5007 +
  1.5008 +/*
  1.5009 + *========================================================================================================
  1.5010 + * MM-A3F-DEVSOUND-CHRTZ-TONE-0036
  1.5011 + */
  1.5012 +RA3FDevSoundTonePlayToneOnceTest::RA3FDevSoundTonePlayToneOnceTest(const TDesC& aTestName)
  1.5013 +	:	RA3FDevSoundTestBase(aTestName),
  1.5014 +		iDuration(0), iFrequencyTone1(0)
  1.5015 +	{
  1.5016 +	}
  1.5017 +
  1.5018 +RA3FDevSoundTonePlayToneOnceTest* RA3FDevSoundTonePlayToneOnceTest::NewL(const TDesC& aTestName)
  1.5019 +	{
  1.5020 +	RA3FDevSoundTonePlayToneOnceTest * self = new(ELeave)RA3FDevSoundTonePlayToneOnceTest(aTestName);
  1.5021 +	return self;
  1.5022 +	}
  1.5023 +
  1.5024 +void RA3FDevSoundTonePlayToneOnceTest::DoKickoffTestL()
  1.5025 +	{
  1.5026 +	if (!GetIntFromConfig(iTestStepName, KDuration, iDuration))
  1.5027 +		{
  1.5028 +		ERR_PRINTF2(KMsgErrorGetParameter, &KDuration);
  1.5029 +		StopTest(KErrNotFound);
  1.5030 +		return;
  1.5031 +		}
  1.5032 +	if (!GetIntFromConfig(iTestStepName, KFrequencyTone1, iFrequencyTone1))
  1.5033 +		{
  1.5034 +		ERR_PRINTF2(KMsgErrorGetParameter, &KFrequencyTone1);
  1.5035 +		StopTest(KErrNotFound);
  1.5036 +		return;
  1.5037 +		}
  1.5038 +	}
  1.5039 +
  1.5040 +void RA3FDevSoundTonePlayToneOnceTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError)
  1.5041 +	{
  1.5042 +	switch (iDevSoundState)
  1.5043 +		{
  1.5044 +		case EStateCreated:
  1.5045 +			{
  1.5046 +			__ASSERT_ALWAYS((aError == KErrNone), Panic(_L("RA3FDevSoundTonePlayToneOnceTest"), EFsmIncorrectErrorPassed));
  1.5047 +			if (aDevSoundEvent == EEventInitialize)
  1.5048 +				{
  1.5049 +				INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL"));
  1.5050 +				TRAPD(err, iMMFDevSound->InitializeL(*this, EMMFStateTonePlaying));
  1.5051 +				if (err != KErrNone)
  1.5052 +					{
  1.5053 +					ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err);
  1.5054 +					StopTest(err);
  1.5055 +					break;
  1.5056 +					}
  1.5057 +				INFO_PRINTF1(_L("DevSound State: EStateInitializing"));
  1.5058 +				iDevSoundState = EStateInitializing;
  1.5059 +				}
  1.5060 +			else
  1.5061 +				{
  1.5062 +				ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent);
  1.5063 +				StopTest(aError, EFail);
  1.5064 +				}
  1.5065 +			break;
  1.5066 +			}
  1.5067 +		case EStateInitializing:
  1.5068 +			{
  1.5069 +			if (aDevSoundEvent == EEventInitComplete && aError == KErrNone)
  1.5070 +				{
  1.5071 +				iMMFDevSound->SetVolume(iMMFDevSound->MaxVolume());
  1.5072 +				INFO_PRINTF3(_L("Calling CMMFDevSound::PlayToneL using %d Hz  during %d secs "), iFrequencyTone1, iDuration);
  1.5073 +				iStartTime.HomeTime();
  1.5074 +				TRAPD(err, iMMFDevSound->PlayToneL(iFrequencyTone1, iDuration*KMicroSecsInOneSec));
  1.5075 +				if (err != KErrNone)
  1.5076 +					{
  1.5077 +					ERR_PRINTF2(_L("CMMFDevSound::PlayToneL failed with error : %d!"), err);
  1.5078 +					StopTest(err);
  1.5079 +					}
  1.5080 +				INFO_PRINTF1(_L("DevSound State: EStatePlaying"));
  1.5081 +				iDevSoundState = EStatePlaying;
  1.5082 +				}
  1.5083 +			else if (aDevSoundEvent == EEventInitComplete && aError != KErrNone)
  1.5084 +				{
  1.5085 +				ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error = %d"), aError);
  1.5086 +				StopTest(aError);
  1.5087 +				}
  1.5088 +			else
  1.5089 +				{
  1.5090 +				ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent);
  1.5091 +				StopTest(aError, EFail);
  1.5092 +				}
  1.5093 +			break;
  1.5094 +			}
  1.5095 +		default:
  1.5096 +			{
  1.5097 +			ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState);
  1.5098 +			StopTest(aError, EFail);
  1.5099 +			}
  1.5100 +		}
  1.5101 +	}
  1.5102 +
  1.5103 +void RA3FDevSoundTonePlayToneOnceTest::ToneFinished(TInt aError)
  1.5104 +	{
  1.5105 +	INFO_PRINTF1(_L("========== DevSound ToneFinished() callback =========="));
  1.5106 +	if (aError == KErrUnderflow)
  1.5107 +		{
  1.5108 +		iEndTime.HomeTime();
  1.5109 +		iPlayToneTime = iEndTime.MicroSecondsFrom(iStartTime);
  1.5110 +		TInt totalExpectedReproductionTime = iDuration * KMicroSecsInOneSec;
  1.5111 +		if(iPlayToneTime < totalExpectedReproductionTime + KPlayVarianceTime && iPlayToneTime > totalExpectedReproductionTime - KPlayVarianceTime)
  1.5112 +			{
  1.5113 +			INFO_PRINTF2(_L("Play time is %Ld microseconds"), iPlayToneTime.Int64());
  1.5114 +			StopTest();
  1.5115 +			}
  1.5116 +		else
  1.5117 +			{
  1.5118 +			ERR_PRINTF3(_L("Play time is %Ld microseconds and it should have been %d microseconds"), iPlayToneTime.Int64(), totalExpectedReproductionTime);
  1.5119 +			StopTest(KErrNone, EFail);
  1.5120 +			}
  1.5121 +		}
  1.5122 +	else
  1.5123 +		{
  1.5124 +		ERR_PRINTF2(_L("DevSound called ToneFinished with error = %d"), aError);
  1.5125 +		ERR_PRINTF2(_L("Expected error = %d"), KErrUnderflow);
  1.5126 +		StopTest(aError, EFail);
  1.5127 +		}
  1.5128 +	}
  1.5129 +
  1.5130 +/*
  1.5131 + *========================================================================================================
  1.5132 + * MM-A3F-DEVSOUND-CHRTZ-TONE-0037
  1.5133 + */
  1.5134 +RA3FDevSoundTonePlayDualToneTest::RA3FDevSoundTonePlayDualToneTest(const TDesC& aTestName)
  1.5135 +	:	RA3FDevSoundTestBase(aTestName),
  1.5136 +		iDuration(0), iFrequencyTone1(0),
  1.5137 +		iFrequencyTone2(0)
  1.5138 +	{
  1.5139 +	}
  1.5140 +RA3FDevSoundTonePlayDualToneTest* RA3FDevSoundTonePlayDualToneTest::NewL(const TDesC& aTestName)
  1.5141 +	{
  1.5142 +	RA3FDevSoundTonePlayDualToneTest * self = new(ELeave)RA3FDevSoundTonePlayDualToneTest(aTestName);
  1.5143 +	return self;
  1.5144 +	}
  1.5145 +void RA3FDevSoundTonePlayDualToneTest::DoKickoffTestL()
  1.5146 +	{
  1.5147 +	if (!GetIntFromConfig(iTestStepName, KDuration, iDuration))
  1.5148 +		{
  1.5149 +		ERR_PRINTF2(KMsgErrorGetParameter, &KDuration);
  1.5150 +		StopTest(KErrNotFound);
  1.5151 +		return;
  1.5152 +		}
  1.5153 +	if (!GetIntFromConfig(iTestStepName, KFrequencyTone1, iFrequencyTone1))
  1.5154 +		{
  1.5155 +		ERR_PRINTF2(KMsgErrorGetParameter, &KFrequencyTone1);
  1.5156 +		StopTest(KErrNotFound);
  1.5157 +		return;
  1.5158 +		}
  1.5159 +	if (!GetIntFromConfig(iTestStepName, KFrequencyTone2, iFrequencyTone2))
  1.5160 +		{
  1.5161 +		ERR_PRINTF2(KMsgErrorGetParameter, &KFrequencyTone2);
  1.5162 +		StopTest(KErrNotFound);
  1.5163 +		return;
  1.5164 +		}
  1.5165 +	}
  1.5166 +
  1.5167 +void RA3FDevSoundTonePlayDualToneTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError)
  1.5168 +	{
  1.5169 +	switch (iDevSoundState)
  1.5170 +		{
  1.5171 +		case EStateCreated:
  1.5172 +			{
  1.5173 +			__ASSERT_ALWAYS((aError == KErrNone), Panic(_L("RA3FDevSoundTonePlayDualToneTest"), EFsmIncorrectErrorPassed));
  1.5174 +			if (aDevSoundEvent == EEventInitialize)
  1.5175 +				{
  1.5176 +				INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL"));
  1.5177 +				TRAPD(err, iMMFDevSound->InitializeL(*this, EMMFStateTonePlaying));
  1.5178 +				if (err != KErrNone)
  1.5179 +					{
  1.5180 +					ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err);
  1.5181 +					StopTest(err);
  1.5182 +					break;
  1.5183 +					}
  1.5184 +				INFO_PRINTF1(_L("DevSound State: EStateInitializing"));
  1.5185 +				iDevSoundState = EStateInitializing;
  1.5186 +				}
  1.5187 +			else
  1.5188 +				{
  1.5189 +				ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent);
  1.5190 +				StopTest(aError, EFail);
  1.5191 +				}
  1.5192 +			break;
  1.5193 +			}
  1.5194 +		case EStateInitializing:
  1.5195 +			{
  1.5196 +			if (aDevSoundEvent == EEventInitComplete && aError == KErrNone)
  1.5197 +				{
  1.5198 +				iMMFDevSound->SetVolume(iMMFDevSound->MaxVolume());
  1.5199 +				iStartTime.HomeTime();
  1.5200 +				INFO_PRINTF4(_L("Calling CMMFDevSound::PlayDualToneL using %d Hz %d Hz during %d secs "), iFrequencyTone1, iFrequencyTone2, iDuration);
  1.5201 +				TRAPD(err, iMMFDevSound->PlayDualToneL(iFrequencyTone1, iFrequencyTone2, iDuration*KMicroSecsInOneSec));
  1.5202 +				if (err != KErrNone)
  1.5203 +					{
  1.5204 +					ERR_PRINTF2(_L("CMMFDevSound::PlayDualToneL left with error : %d!"),  err);
  1.5205 +					StopTest(err);
  1.5206 +					break;
  1.5207 +					}
  1.5208 +				INFO_PRINTF1(_L("DevSound State: EStatePlaying"));
  1.5209 +				iDevSoundState = EStatePlaying;
  1.5210 +				}
  1.5211 +			else if (aDevSoundEvent == EEventInitComplete && aError != KErrNone)
  1.5212 +				{
  1.5213 +				ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error = %d"), aError);
  1.5214 +				StopTest(aError);
  1.5215 +				}
  1.5216 +			else
  1.5217 +				{
  1.5218 +				ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent);
  1.5219 +				StopTest(aError, EFail);
  1.5220 +				}
  1.5221 +			break;
  1.5222 +			}
  1.5223 +		default:
  1.5224 +			{
  1.5225 +			ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState);
  1.5226 +			StopTest(aError, EFail);
  1.5227 +			}
  1.5228 +		}
  1.5229 +	}
  1.5230 +
  1.5231 +void RA3FDevSoundTonePlayDualToneTest::ToneFinished(TInt aError)
  1.5232 +	{
  1.5233 +	INFO_PRINTF1(_L("========== DevSound ToneFinished() callback =========="));
  1.5234 +	if (aError == KErrUnderflow)
  1.5235 +		{
  1.5236 +		iEndTime.HomeTime();
  1.5237 +		iPlayToneTime = iEndTime.MicroSecondsFrom(iStartTime);
  1.5238 +		TInt totalExpectedReproductionTime = iDuration * KMicroSecsInOneSec;
  1.5239 +		if(iPlayToneTime < totalExpectedReproductionTime + KPlayVarianceTime && iPlayToneTime > totalExpectedReproductionTime - KPlayVarianceTime)
  1.5240 +			{
  1.5241 +			INFO_PRINTF2(_L("Play time is %Ld microseconds"), iPlayToneTime.Int64());
  1.5242 +			StopTest();
  1.5243 +			}
  1.5244 +		else
  1.5245 +			{
  1.5246 +			ERR_PRINTF3(_L("Play time is %Ld microseconds and it should have been %d microseconds"), iPlayToneTime.Int64(), totalExpectedReproductionTime);
  1.5247 +			StopTest(KErrNone, EFail);
  1.5248 +			}
  1.5249 +		}
  1.5250 +	else
  1.5251 +		{
  1.5252 +		ERR_PRINTF2(_L("DevSound called ToneFinished with error = %d"), aError);
  1.5253 +		ERR_PRINTF2(_L("Expected error = %d"), KErrUnderflow);
  1.5254 +		StopTest(aError, EFail);
  1.5255 +		}
  1.5256 +	}
  1.5257 +
  1.5258 +/*
  1.5259 + *========================================================================================================
  1.5260 + * MM-A3F-DEVSOUND-CHRTZ-TONE-0038
  1.5261 + */
  1.5262 +RA3FDevSoundTonePlayDTMFToneTest::RA3FDevSoundTonePlayDTMFToneTest(const TDesC& aTestName)
  1.5263 +	:	RA3FDevSoundTestBase(aTestName),iDTMFString(KNullDesC),
  1.5264 +		iDTMFPauses(0), iDTMFTones(0)
  1.5265 +
  1.5266 +	{
  1.5267 +	}
  1.5268 +
  1.5269 +RA3FDevSoundTonePlayDTMFToneTest* RA3FDevSoundTonePlayDTMFToneTest::NewL(const TDesC& aTestName)
  1.5270 +	{
  1.5271 +	RA3FDevSoundTonePlayDTMFToneTest * self = new(ELeave)RA3FDevSoundTonePlayDTMFToneTest(aTestName);
  1.5272 +	return self;
  1.5273 +	}
  1.5274 +
  1.5275 +void RA3FDevSoundTonePlayDTMFToneTest::DoKickoffTestL()
  1.5276 +	{
  1.5277 +	TPtrC DTMF;
  1.5278 +	if (!GetStringFromConfig(iTestStepName, KDTMFString, DTMF))
  1.5279 +		{
  1.5280 +		ERR_PRINTF2(KMsgErrorGetParameter, &KDTMFString);
  1.5281 +		StopTest(KErrNotFound);
  1.5282 +		return;
  1.5283 +		}
  1.5284 +	iDTMFString.Copy(DTMF);
  1.5285 +	for(TInt i =0 ; i< iDTMFString.Length() ; i++)
  1.5286 +		{
  1.5287 +		if (iDTMFString[i] == ',')
  1.5288 +			{
  1.5289 +			iDTMFPauses++;
  1.5290 +			}
  1.5291 +		else
  1.5292 +			{
  1.5293 +			iDTMFTones++;
  1.5294 +			}
  1.5295 +		}
  1.5296 +	}
  1.5297 +
  1.5298 +void RA3FDevSoundTonePlayDTMFToneTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError)
  1.5299 +	{
  1.5300 +	switch (iDevSoundState)
  1.5301 +		{
  1.5302 +		case EStateCreated:
  1.5303 +			{
  1.5304 +			__ASSERT_ALWAYS((aError == KErrNone), Panic(_L("RA3FDevSoundTonePlayDTMFToneTest"), EFsmIncorrectErrorPassed));
  1.5305 +			if (aDevSoundEvent == EEventInitialize)
  1.5306 +				{
  1.5307 +				INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL"));
  1.5308 +				TRAPD(err, iMMFDevSound->InitializeL(*this, EMMFStateTonePlaying));
  1.5309 +				if (err != KErrNone)
  1.5310 +					{
  1.5311 +					ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"),  err);
  1.5312 +					StopTest(err);
  1.5313 +					break;
  1.5314 +					}
  1.5315 +				INFO_PRINTF1(_L("DevSound State: EStateInitializing"));
  1.5316 +				iDevSoundState = EStateInitializing;
  1.5317 +				}
  1.5318 +			else
  1.5319 +				{
  1.5320 +				ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent);
  1.5321 +				StopTest(aError,  EFail);
  1.5322 +				}
  1.5323 +			break;
  1.5324 +			}
  1.5325 +		case EStateInitializing:
  1.5326 +			{
  1.5327 +			if (aDevSoundEvent == EEventInitComplete && aError == KErrNone)
  1.5328 +				{
  1.5329 +				iMMFDevSound->SetVolume(iMMFDevSound->MaxVolume());
  1.5330 +				iStartTime.HomeTime();
  1.5331 +				INFO_PRINTF2(_L("Calling CMMFDevSound::PlayDTMFStringL %S"), &iDTMFString);
  1.5332 +				TRAPD(err, iMMFDevSound->PlayDTMFStringL(iDTMFString));
  1.5333 +				if (err != KErrNone)
  1.5334 +					{
  1.5335 +					ERR_PRINTF2(_L("CMMFDevSound::PlayDTMFStringL left with error : %d!"), err);
  1.5336 +					StopTest(err);
  1.5337 +					break;
  1.5338 +					}
  1.5339 +				INFO_PRINTF1(_L("DevSound State: EStatePlaying"));
  1.5340 +				iDevSoundState = EStatePlaying;
  1.5341 +				}
  1.5342 +			else if (aDevSoundEvent == EEventInitComplete && aError != KErrNone)
  1.5343 +				{
  1.5344 +				ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error = %d"), aError);
  1.5345 +				StopTest(aError);
  1.5346 +				}
  1.5347 +			else
  1.5348 +				{
  1.5349 +				ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent);
  1.5350 +				StopTest(aError, EFail);
  1.5351 +				}
  1.5352 +			break;
  1.5353 +			}
  1.5354 +		default:
  1.5355 +			{
  1.5356 +			ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState);
  1.5357 +			StopTest(aError, EFail);
  1.5358 +			}
  1.5359 +		}
  1.5360 +	}
  1.5361 +
  1.5362 +void RA3FDevSoundTonePlayDTMFToneTest::ToneFinished(TInt aError)
  1.5363 +	{
  1.5364 +	INFO_PRINTF1(_L("========== DevSound ToneFinished() callback =========="));
  1.5365 +	if (aError == KErrUnderflow)
  1.5366 +		{
  1.5367 +		iEndTime.HomeTime();
  1.5368 +		iPlayToneTime = iEndTime.MicroSecondsFrom(iStartTime);
  1.5369 +		TInt defaultToneOn = 250000;
  1.5370 +		TInt defaultToneOff = 50000;
  1.5371 +		TInt defaultPauseLength = 250000;
  1.5372 +		TInt totalExpectedReproductionTime = defaultToneOn*iDTMFTones + defaultToneOff * iDTMFTones + iDTMFPauses * defaultPauseLength;
  1.5373 +		if (iPlayToneTime < totalExpectedReproductionTime + KPlayVarianceTime && iPlayToneTime > totalExpectedReproductionTime - KPlayVarianceTime)
  1.5374 +			{
  1.5375 +			INFO_PRINTF2(_L("Play time is %Ld microseconds"), iPlayToneTime.Int64());
  1.5376 +			StopTest();
  1.5377 +			}
  1.5378 +		else
  1.5379 +			{
  1.5380 +			ERR_PRINTF2(_L("Calling CMMFDevSound::PlayDTMFStringL failed with %Ld"), iPlayToneTime.Int64());
  1.5381 +			ERR_PRINTF2(_L("Expected time %d"), totalExpectedReproductionTime);
  1.5382 +			StopTest(KErrNone, EFail);
  1.5383 +			}
  1.5384 +		}
  1.5385 +	else
  1.5386 +		{
  1.5387 +		ERR_PRINTF2(_L("DevSound called ToneFinished with error = %d"), aError);
  1.5388 +		ERR_PRINTF2(_L("Expected error = %d"), KErrUnderflow);
  1.5389 +		StopTest(aError, EFail);
  1.5390 +		}
  1.5391 +	}
  1.5392 +
  1.5393 +/*
  1.5394 + *========================================================================================================
  1.5395 + * MM-A3F-DEVSOUND-CHRTZ-TONE-0039
  1.5396 + */
  1.5397 +RA3FDevSoundTonePlayToneSequenceTest::RA3FDevSoundTonePlayToneSequenceTest(const TDesC& aTestName)
  1.5398 +	:	RA3FDevSoundTestBase(aTestName)
  1.5399 +	{
  1.5400 +	}
  1.5401 +
  1.5402 +RA3FDevSoundTonePlayToneSequenceTest* RA3FDevSoundTonePlayToneSequenceTest::NewL(const TDesC& aTestName)
  1.5403 +	{
  1.5404 +	RA3FDevSoundTonePlayToneSequenceTest * self = new(ELeave)RA3FDevSoundTonePlayToneSequenceTest(aTestName);
  1.5405 +	return self;
  1.5406 +	}
  1.5407 +
  1.5408 +void RA3FDevSoundTonePlayToneSequenceTest::DoKickoffTestL()
  1.5409 +	{
  1.5410 +	}
  1.5411 +
  1.5412 +void RA3FDevSoundTonePlayToneSequenceTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError)
  1.5413 +	{
  1.5414 +	switch(iDevSoundState)
  1.5415 +		{
  1.5416 +		case EStateCreated:
  1.5417 +			{
  1.5418 +			__ASSERT_ALWAYS((aError == KErrNone), Panic(_L("RA3FDevSoundTonePlayToneSequenceTest"), EFsmIncorrectErrorPassed));
  1.5419 +			if (aDevSoundEvent == EEventInitialize)
  1.5420 +				{
  1.5421 +				INFO_PRINTF1(_L("Calling MMFDevSound::InitializeL"));
  1.5422 +				TRAPD(err, iMMFDevSound->InitializeL(*this,  EMMFStateTonePlaying));
  1.5423 +				if (err != KErrNone)
  1.5424 +					{
  1.5425 +					ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err);
  1.5426 +					StopTest(err);
  1.5427 +					break;
  1.5428 +					}
  1.5429 +				INFO_PRINTF1(_L("DevSound State: EStateInitializing"));
  1.5430 +				iDevSoundState = EStateInitializing;
  1.5431 +				}
  1.5432 +			else
  1.5433 +				{
  1.5434 +				ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent);
  1.5435 +				StopTest(aError, EFail);
  1.5436 +				}
  1.5437 +			break;
  1.5438 +			}
  1.5439 +		case EStateInitializing:
  1.5440 +			{
  1.5441 +			if (aDevSoundEvent == EEventInitComplete && aError == KErrNone)
  1.5442 +				{
  1.5443 +				iMMFDevSound->SetVolume(iMMFDevSound->MaxVolume());
  1.5444 +				TUint8* tablePointer = const_cast<TUint8*>(&(KFixedSequenceTestSequenceDataX[0]));
  1.5445 +				TPtrC8 KFixedSequenceData(tablePointer, sizeof(KFixedSequenceTestSequenceDataX));
  1.5446 +				INFO_PRINTF1(_L("Calling CMMFDevSound::PlayToneSequenceL"));
  1.5447 +				TRAPD(err, iMMFDevSound->PlayToneSequenceL(KFixedSequenceData));
  1.5448 +				if (err != KErrNone)
  1.5449 +					{
  1.5450 +					ERR_PRINTF2(_L("Play tone sequence failed with error = %d!"), err);
  1.5451 +					StopTest(err);
  1.5452 +					break;
  1.5453 +					}
  1.5454 +				INFO_PRINTF1(_L("DevSound State: EStatePlaying"));
  1.5455 +				iDevSoundState = EStatePlaying;
  1.5456 +				}
  1.5457 +			else if (aDevSoundEvent == EEventInitComplete && aError != KErrNone)
  1.5458 +				{
  1.5459 +				ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error = %d"), aError);
  1.5460 +				StopTest(aError);
  1.5461 +				}
  1.5462 +			else
  1.5463 +				{
  1.5464 +				ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent);
  1.5465 +				StopTest(aError, EFail);
  1.5466 +				}
  1.5467 +			break;
  1.5468 +			}
  1.5469 +		default:
  1.5470 +			{
  1.5471 +			ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState);
  1.5472 +			StopTest(aError, EFail);
  1.5473 +			}
  1.5474 +		}
  1.5475 +	}
  1.5476 +
  1.5477 +/*
  1.5478 + *========================================================================================================
  1.5479 + * MM-A3F-DEVSOUND-CHRTZ-TONE-0040
  1.5480 + */
  1.5481 +RA3FDevSoundToneNewToneRequestWhilePlayingTest::RA3FDevSoundToneNewToneRequestWhilePlayingTest(const TDesC& aTestName)
  1.5482 +	:	RA3FDevSoundTestBase(aTestName),
  1.5483 +		iDuration(0), iFrequencyTone1(0)
  1.5484 +	{
  1.5485 +	}
  1.5486 +
  1.5487 +RA3FDevSoundToneNewToneRequestWhilePlayingTest* RA3FDevSoundToneNewToneRequestWhilePlayingTest::NewL(const TDesC& aTestName)
  1.5488 +	{
  1.5489 +	RA3FDevSoundToneNewToneRequestWhilePlayingTest * self = new(ELeave)RA3FDevSoundToneNewToneRequestWhilePlayingTest(aTestName);
  1.5490 +	return self;
  1.5491 +	}
  1.5492 +
  1.5493 +void RA3FDevSoundToneNewToneRequestWhilePlayingTest::DoKickoffTestL()
  1.5494 +	{
  1.5495 +	if (!GetIntFromConfig(iTestStepName, KDuration, iDuration))
  1.5496 +		{
  1.5497 +		ERR_PRINTF2(KMsgErrorGetParameter, &KDuration);
  1.5498 +		StopTest(KErrNotFound);
  1.5499 +		return;
  1.5500 +		}
  1.5501 +	if (!GetIntFromConfig(iTestStepName, KFrequencyTone1, iFrequencyTone1))
  1.5502 +		{
  1.5503 +		ERR_PRINTF2(KMsgErrorGetParameter, &KFrequencyTone1);
  1.5504 +		StopTest(KErrNotFound);
  1.5505 +		return;
  1.5506 +		}
  1.5507 +	iTimer = CPeriodic::NewL(CActive::EPriorityHigh);
  1.5508 +	}
  1.5509 +
  1.5510 +void RA3FDevSoundToneNewToneRequestWhilePlayingTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError)
  1.5511 +	{
  1.5512 +	switch (iDevSoundState)
  1.5513 +		{
  1.5514 +		case EStateCreated:
  1.5515 +			{
  1.5516 +			if (aDevSoundEvent == EEventInitialize)
  1.5517 +				{
  1.5518 +				__ASSERT_ALWAYS((aError == KErrNone), Panic(_L("RA3FDevSoundToneNewToneRequestWhilePlayingTest"), EFsmIncorrectErrorPassed));
  1.5519 +				INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL"));
  1.5520 +				TRAPD(err, iMMFDevSound->InitializeL(*this, EMMFStateTonePlaying));
  1.5521 +				if (err != KErrNone)
  1.5522 +					{
  1.5523 +					ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err);
  1.5524 +					StopTest(err);
  1.5525 +					break;
  1.5526 +					}
  1.5527 +				INFO_PRINTF1(_L("DevSound State: EStateInitializing"));
  1.5528 +				iDevSoundState = EStateInitializing;
  1.5529 +				}
  1.5530 +			else
  1.5531 +				{
  1.5532 +				ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent);
  1.5533 +				StopTest(aError, EFail);
  1.5534 +				}
  1.5535 +			break;
  1.5536 +			}
  1.5537 +		case EStateInitializing:
  1.5538 +			{
  1.5539 +			if (aDevSoundEvent == EEventInitComplete && aError == KErrNone)
  1.5540 +				{
  1.5541 +				iMMFDevSound->SetVolume(iMMFDevSound->MaxVolume());
  1.5542 +				iStartTime.HomeTime();
  1.5543 +				INFO_PRINTF3(_L("Calling CMMFDevSound::PlayToneL using %d Hz during %d secs "), iFrequencyTone1, iDuration);
  1.5544 +				TRAPD(err, iMMFDevSound->PlayToneL(iFrequencyTone1, iDuration*KMicroSecsInOneSec));
  1.5545 +				if (err != KErrNone)
  1.5546 +					{
  1.5547 +					ERR_PRINTF2(_L("CMMFDevSound::PlayToneL left with error : %d!"), err);
  1.5548 +					StopTest(err);
  1.5549 +					break;
  1.5550 +					}
  1.5551 +				StartTimer(KMicroSecsTwoSec);
  1.5552 +				INFO_PRINTF1(_L("DevSound State: EStatePlaying"));
  1.5553 +				iDevSoundState = EStatePlaying;
  1.5554 +				}
  1.5555 +			else if (aDevSoundEvent == EEventInitComplete && aError != KErrNone)
  1.5556 +				{
  1.5557 +				ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error = %d"), aError);
  1.5558 +				StopTest(aError);
  1.5559 +				}
  1.5560 +			else
  1.5561 +				{
  1.5562 +				ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent);
  1.5563 +				StopTest(aError, EFail);
  1.5564 +				}
  1.5565 +			break;
  1.5566 +			}
  1.5567 +		case EStatePlaying:
  1.5568 +			{
  1.5569 +			if(aDevSoundEvent == EEventTimerComplete)
  1.5570 +				{
  1.5571 +				INFO_PRINTF3(_L("Calling CMMFDevSound::PlayToneL using %d Hz during %d secs "), iFrequencyTone1, iDuration);
  1.5572 +				TRAPD(err, iMMFDevSound->PlayToneL(iFrequencyTone1, iDuration*KMicroSecsInOneSec));
  1.5573 +				if (err == KErrNone)
  1.5574 +					{
  1.5575 +					INFO_PRINTF2(_L("CMMFDevSound::PlayToneL left with the expected error = %d"), err);
  1.5576 +					}
  1.5577 +				else
  1.5578 +					{
  1.5579 +					ERR_PRINTF2(_L("CMMFDevSound::PlayToneL left with error = %d"), err);
  1.5580 +					ERR_PRINTF2(_L("Expected error value = %d!"), KErrNotReady);
  1.5581 +					StopTest(err);
  1.5582 +					break;
  1.5583 +					}
  1.5584 +				}
  1.5585 +			break;
  1.5586 +			}
  1.5587 +		default:
  1.5588 +			{
  1.5589 +			ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState);
  1.5590 +			StopTest(aError, EFail);
  1.5591 +			}
  1.5592 +		}
  1.5593 +	}
  1.5594 +
  1.5595 +void RA3FDevSoundToneNewToneRequestWhilePlayingTest::DoTimerCallback()
  1.5596 +	{
  1.5597 +	INFO_PRINTF1(_L("TimerEvent called"));
  1.5598 +	iTimer->Cancel();
  1.5599 +	INFO_PRINTF1(_L("DevSound Event: EEventTimerComplete"));
  1.5600 +	Fsm(EEventTimerComplete, KErrNone);
  1.5601 +	}
  1.5602 +
  1.5603 +void RA3FDevSoundToneNewToneRequestWhilePlayingTest::ToneFinished(TInt aError)
  1.5604 +	{
  1.5605 +	INFO_PRINTF1(_L("========== DevSound ToneFinished() callback =========="));
  1.5606 +	if (aError == KErrUnderflow)
  1.5607 +		{
  1.5608 +		iEndTime.HomeTime();
  1.5609 +		iPlayToneTime = iEndTime.MicroSecondsFrom(iStartTime);
  1.5610 +		TInt totalExpectedReproductionTime = iDuration * KMicroSecsInOneSec;
  1.5611 +		if(iPlayToneTime < totalExpectedReproductionTime + KPlayVarianceTime && iPlayToneTime > totalExpectedReproductionTime - KPlayVarianceTime)
  1.5612 +			{
  1.5613 +			INFO_PRINTF2(_L("Play time is %Ld microseconds"), iPlayToneTime.Int64());
  1.5614 +			StopTest();
  1.5615 +			}
  1.5616 +		else
  1.5617 +			{
  1.5618 +			ERR_PRINTF3(_L("Play time is %Ld microseconds and it should have been %d microseconds"), iPlayToneTime.Int64(), totalExpectedReproductionTime);
  1.5619 +			StopTest(KErrNone, EFail);
  1.5620 +			}
  1.5621 +		}
  1.5622 +	else
  1.5623 +		{
  1.5624 +		ERR_PRINTF2(_L("DevSound called ToneFinished with error = %d"), aError);
  1.5625 +		ERR_PRINTF2(_L("Expected error = %d"), KErrUnderflow);
  1.5626 +		StopTest(aError, EFail);
  1.5627 +		}
  1.5628 +	}
  1.5629 +
  1.5630 +/*
  1.5631 + *========================================================================================================
  1.5632 + * MM-A3F-DEVSOUND-CHRTZ-TONE-0041
  1.5633 + */
  1.5634 +RA3FDevSoundTonePreemptionTest::RA3FDevSoundTonePreemptionTest(const TDesC& aTestName)
  1.5635 +	:	RA3FDevSoundTestBase(aTestName),
  1.5636 +		iDuration(0), iFrequencyTone1(0)
  1.5637 +	{
  1.5638 +	}
  1.5639 +
  1.5640 +RA3FDevSoundTonePreemptionTest* RA3FDevSoundTonePreemptionTest::NewL(const TDesC& aTestName)
  1.5641 +	{
  1.5642 +	RA3FDevSoundTonePreemptionTest * self = new(ELeave)RA3FDevSoundTonePreemptionTest(aTestName);
  1.5643 +	return self;
  1.5644 +	}
  1.5645 +
  1.5646 +void RA3FDevSoundTonePreemptionTest::DoKickoffTestL()
  1.5647 +	{
  1.5648 +	if (!GetIntFromConfig(iTestStepName, KDuration, iDuration))
  1.5649 +		{
  1.5650 +		ERR_PRINTF2(KMsgErrorGetParameter, &KDuration);
  1.5651 +		StopTest(KErrNotFound);
  1.5652 +		return;
  1.5653 +		}
  1.5654 +	if (!GetIntFromConfig(iTestStepName, KFrequencyTone1, iFrequencyTone1))
  1.5655 +		{
  1.5656 +		ERR_PRINTF2(KMsgErrorGetParameter, &KFrequencyTone1);
  1.5657 +		StopTest(KErrNotFound);
  1.5658 +		return;
  1.5659 +		}
  1.5660 +	iTimer = CPeriodic::NewL(CActive::EPriorityHigh);
  1.5661 +	iDevsoundToneClient = CA3FDevSoundToneClient::NewL(*this);
  1.5662 +	}
  1.5663 +
  1.5664 +void RA3FDevSoundTonePreemptionTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError)
  1.5665 +	{
  1.5666 +	switch (iDevSoundState)
  1.5667 +		{
  1.5668 +		case EStateCreated:
  1.5669 +			{
  1.5670 +			if (aDevSoundEvent == EEventInitialize)
  1.5671 +				{
  1.5672 +				__ASSERT_ALWAYS((aError == KErrNone), Panic(_L("RA3FDevSoundTonePreemptionTest"), EFsmIncorrectErrorPassed));
  1.5673 +				INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL"));
  1.5674 +				TRAPD(err, iMMFDevSound->InitializeL(*this, EMMFStateTonePlaying));
  1.5675 +				if (err != KErrNone)
  1.5676 +					{
  1.5677 +					ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err);
  1.5678 +					StopTest(err);
  1.5679 +					break;
  1.5680 +					}
  1.5681 +				INFO_PRINTF1(_L("DevSound State: EStateInitializing"));
  1.5682 +				iDevSoundState = EStateInitializing;
  1.5683 +				}
  1.5684 +			else
  1.5685 +				{
  1.5686 +				ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent);
  1.5687 +				StopTest(aError, EFail);
  1.5688 +				}
  1.5689 +			break;
  1.5690 +			}
  1.5691 +		case EStateInitializing:
  1.5692 +			{
  1.5693 +			if (aDevSoundEvent == EEventInitComplete && aError == KErrNone)
  1.5694 +				{
  1.5695 +				iMMFDevSound->SetVolume(iMMFDevSound->MaxVolume());
  1.5696 +				TMMFPrioritySettings prioritySettings;
  1.5697 +				prioritySettings.iPriority = KMinimumPriority;
  1.5698 +				prioritySettings.iPref = EMdaPriorityPreferenceTime;
  1.5699 +				prioritySettings.iState = EMMFStateIdle;
  1.5700 +				iMMFDevSound->SetPrioritySettings(prioritySettings);
  1.5701 +				INFO_PRINTF3(_L("Calling CMMFDevSound::PlayToneL using %d Hz during %d secs "), iFrequencyTone1, iDuration);
  1.5702 +				TRAPD(err, iMMFDevSound->PlayToneL(iFrequencyTone1, iDuration*KMicroSecsInOneSec));
  1.5703 +				if (err != KErrNone)
  1.5704 +					{
  1.5705 +					ERR_PRINTF2(_L("CMMFDevSound::PlayToneL left with error : %d!"), err);
  1.5706 +					StopTest(err);
  1.5707 +					break;
  1.5708 +					}
  1.5709 +				StartTimer(KMicroSecsTwoSec);
  1.5710 +				INFO_PRINTF1(_L("DevSound State: EStatePlaying"));
  1.5711 +				iDevSoundState = EStatePlaying;
  1.5712 +				}
  1.5713 +			else if (aDevSoundEvent == EEventInitComplete && aError != KErrNone)
  1.5714 +				{
  1.5715 +				ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error = %d"), aError);
  1.5716 +				StopTest(aError);
  1.5717 +				}
  1.5718 +			else
  1.5719 +				{
  1.5720 +				ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent);
  1.5721 +				StopTest(aError, EFail);
  1.5722 +				}
  1.5723 +			break;
  1.5724 +			}
  1.5725 +		case EStatePlaying:
  1.5726 +			{
  1.5727 +			if(aDevSoundEvent == EEventTimerComplete)
  1.5728 +				{
  1.5729 +				INFO_PRINTF1(_L("Starting lower priority devsound client"));
  1.5730 +				iDevsoundToneClient->SetPriority(KMaximumPriority);
  1.5731 +				TInt err = iDevsoundToneClient->InitTonePlay(iFrequencyTone1, iDuration*KMicroSecsInOneSec);
  1.5732 +				if(err != KErrNone)
  1.5733 +					{
  1.5734 +					ERR_PRINTF1(_L("Initialization to play tone thru second devsound client failed"));
  1.5735 +					StopTest(err);
  1.5736 +					}
  1.5737 +				}
  1.5738 +			break;
  1.5739 +			}
  1.5740 +		default:
  1.5741 +			{
  1.5742 +			ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState);
  1.5743 +			StopTest(aError, EFail);
  1.5744 +			}
  1.5745 +		}
  1.5746 +	}
  1.5747 +
  1.5748 +void RA3FDevSoundTonePreemptionTest::DoTimerCallback()
  1.5749 +	{
  1.5750 +	INFO_PRINTF1(_L("TimerEvent called"));
  1.5751 +	iTimer->Cancel();
  1.5752 +	INFO_PRINTF1(_L("DevSound Event: EEventTimerComplete"));
  1.5753 +	Fsm(EEventTimerComplete, KErrNone);
  1.5754 +	}
  1.5755 +
  1.5756 +void RA3FDevSoundTonePreemptionTest::ToneFinished(TInt aError)
  1.5757 +	{
  1.5758 +	INFO_PRINTF1(_L("========== DevSound ToneFinished() callback =========="));
  1.5759 +	if (aError == KErrInUse || aError == KErrDied || aError == KErrAccessDenied)
  1.5760 +		{
  1.5761 +		INFO_PRINTF1(_L("========== Preempting 1st DevSound Instance=========="));
  1.5762 +		}
  1.5763 +	else
  1.5764 +		{
  1.5765 +		ERR_PRINTF2(_L("First DevSound client called ToneFinished() and failed with error = %d "), aError);
  1.5766 +		ERR_PRINTF4(_L("Expected posibilities %d %d %d "), KErrInUse, KErrDied, KErrAccessDenied);
  1.5767 +		StopTest(aError, EFail);
  1.5768 +		}
  1.5769 +	}
  1.5770 +
  1.5771 +
  1.5772 +void RA3FDevSoundTonePreemptionTest::ClientInitializeCompleteCallback(TInt aError)
  1.5773 +	{
  1.5774 +	INFO_PRINTF1(_L("========== Second Client DevSound InitializeComplete() callback =========="));
  1.5775 +	if (aError != KErrNone)
  1.5776 +		{
  1.5777 +		ERR_PRINTF2(_L("Second Devsound InitializeComplete received an error = %d"), aError);
  1.5778 +		StopTest(aError);
  1.5779 +		}
  1.5780 +	else
  1.5781 +		{
  1.5782 +		INFO_PRINTF1(_L("Starting to play audio thru second devsound client"));
  1.5783 +		TInt err = iDevsoundToneClient->PlayTone();
  1.5784 +		if (err != KErrNone)
  1.5785 +			{
  1.5786 +			ERR_PRINTF2(_L("Starting to play tones thru second devsound client left with error = %d"), err);
  1.5787 +			StopTest(err);
  1.5788 +			}
  1.5789 +		}
  1.5790 +	}
  1.5791 +
  1.5792 +void RA3FDevSoundTonePreemptionTest::ClientToneFinishedCallback(TInt aError)
  1.5793 +	{
  1.5794 +	INFO_PRINTF1(_L("========== DevSound ToneFinished() callback =========="));
  1.5795 +		if (aError == KErrUnderflow)
  1.5796 +			{
  1.5797 +			INFO_PRINTF2(_L("Second DevSound instance called ToneFinished with error = %d"), aError);
  1.5798 +			StopTest(aError,EPass);
  1.5799 +			}
  1.5800 +		else
  1.5801 +			{
  1.5802 +			ERR_PRINTF2(_L("Second DevSound instance called ToneFinished with error = %d that was NOT expected"), aError);
  1.5803 +			ERR_PRINTF2(_L("Expected error = %d"), aError);
  1.5804 +			StopTest(aError);
  1.5805 +			}
  1.5806 +	}
  1.5807 +
  1.5808 +/*
  1.5809 + *========================================================================================================
  1.5810 + * MM-A3F-DEVSOUND-CHRTZ-TONE-0042
  1.5811 + */
  1.5812 +RA3FDevSoundToneRejectionTest::RA3FDevSoundToneRejectionTest(const TDesC& aTestName)
  1.5813 +	:	RA3FDevSoundTestBase(aTestName),
  1.5814 +		iDuration(0), iFrequencyTone1(0)
  1.5815 +	{
  1.5816 +	}
  1.5817 +
  1.5818 +RA3FDevSoundToneRejectionTest* RA3FDevSoundToneRejectionTest::NewL(const TDesC& aTestName)
  1.5819 +	{
  1.5820 +	RA3FDevSoundToneRejectionTest * self = new(ELeave)RA3FDevSoundToneRejectionTest(aTestName);
  1.5821 +	return self;
  1.5822 +	}
  1.5823 +
  1.5824 +void RA3FDevSoundToneRejectionTest::DoKickoffTestL()
  1.5825 +	{
  1.5826 +	if (!GetIntFromConfig(iTestStepName, KDuration, iDuration))
  1.5827 +		{
  1.5828 +		ERR_PRINTF2(KMsgErrorGetParameter, &KDuration);
  1.5829 +		StopTest(KErrNotFound);
  1.5830 +		return;
  1.5831 +		}
  1.5832 +	if (!GetIntFromConfig(iTestStepName, KFrequencyTone1, iFrequencyTone1))
  1.5833 +		{
  1.5834 +		ERR_PRINTF2(KMsgErrorGetParameter, &KFrequencyTone1);
  1.5835 +		StopTest(KErrNotFound);
  1.5836 +		return;
  1.5837 +		}
  1.5838 +	iTimer = CPeriodic::NewL(CActive::EPriorityHigh);
  1.5839 +	iDevsoundToneClient = CA3FDevSoundToneClient::NewL(*this);
  1.5840 +	}
  1.5841 +
  1.5842 +void RA3FDevSoundToneRejectionTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError)
  1.5843 +	{
  1.5844 +	switch (iDevSoundState)
  1.5845 +		{
  1.5846 +		case EStateCreated:
  1.5847 +			{
  1.5848 +			if (aDevSoundEvent == EEventInitialize)
  1.5849 +				{
  1.5850 +				__ASSERT_ALWAYS((aError == KErrNone), Panic(_L("RA3FDevSoundToneRejectionTest"), EFsmIncorrectErrorPassed));
  1.5851 +				INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL"));
  1.5852 +				TRAPD(err, iMMFDevSound->InitializeL(*this, EMMFStateTonePlaying));
  1.5853 +				if (err != KErrNone)
  1.5854 +					{
  1.5855 +					ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err);
  1.5856 +					StopTest(err);
  1.5857 +					break;
  1.5858 +					}
  1.5859 +				INFO_PRINTF1(_L("DevSound State: EStateInitializing"));
  1.5860 +				iDevSoundState = EStateInitializing;
  1.5861 +				}
  1.5862 +			else
  1.5863 +				{
  1.5864 +				ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent);
  1.5865 +				StopTest(aError, EFail);
  1.5866 +				}
  1.5867 +			break;
  1.5868 +			}
  1.5869 +		case EStateInitializing:
  1.5870 +			{
  1.5871 +			if (aDevSoundEvent == EEventInitComplete && aError == KErrNone)
  1.5872 +				{
  1.5873 +				iMMFDevSound->SetVolume(iMMFDevSound->MaxVolume());
  1.5874 +				TMMFPrioritySettings prioritySettings;
  1.5875 +				prioritySettings.iPriority = KMinimumPriority;
  1.5876 +				prioritySettings.iPref = EMdaPriorityPreferenceTime;
  1.5877 +				prioritySettings.iState = EMMFStateIdle;
  1.5878 +				iMMFDevSound->SetPrioritySettings(prioritySettings);
  1.5879 +				INFO_PRINTF3(_L("Calling CMMFDevSound::PlayToneL using %d Hz during %d secs "), iFrequencyTone1, iDuration);
  1.5880 +				TRAPD(err, iMMFDevSound->PlayToneL(iFrequencyTone1, iDuration*KMicroSecsInOneSec));
  1.5881 +				if (err != KErrNone)
  1.5882 +					{
  1.5883 +					ERR_PRINTF2(_L("CMMFDevSound::PlayToneL left with error : %d!"), err);
  1.5884 +					StopTest(err);
  1.5885 +					break;
  1.5886 +					}
  1.5887 +				StartTimer(KMicroSecsTwoSec);
  1.5888 +				INFO_PRINTF1(_L("DevSound State: EStatePlaying"));
  1.5889 +				iDevSoundState = EStatePlaying;
  1.5890 +				}
  1.5891 +			else if (aDevSoundEvent == EEventInitComplete && aError != KErrNone)
  1.5892 +				{
  1.5893 +				ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error = %d"), aError);
  1.5894 +				StopTest(aError);
  1.5895 +				}
  1.5896 +			else
  1.5897 +				{
  1.5898 +				ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent);
  1.5899 +				StopTest(aError, EFail);
  1.5900 +				}
  1.5901 +			break;
  1.5902 +			}
  1.5903 +		case EStatePlaying:
  1.5904 +			{
  1.5905 +			if(aDevSoundEvent == EEventTimerComplete)
  1.5906 +				{
  1.5907 +				INFO_PRINTF1(_L("Starting lower priority devsound client"));
  1.5908 +				iDevsoundToneClient->SetPriority(KMinimumPriority);
  1.5909 +				TInt err = iDevsoundToneClient->InitTonePlay(iFrequencyTone1, iDuration*KMicroSecsInOneSec);
  1.5910 +				if(err != KErrNone)
  1.5911 +					{
  1.5912 +					ERR_PRINTF1(_L("Initialization to play tone thru second devsound client failed"));
  1.5913 +					StopTest(err);
  1.5914 +					}
  1.5915 +				}
  1.5916 +			break;
  1.5917 +			}
  1.5918 +		default:
  1.5919 +			{
  1.5920 +			ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState);
  1.5921 +			StopTest(aError, EFail);
  1.5922 +			}
  1.5923 +		}
  1.5924 +	}
  1.5925 +
  1.5926 +void RA3FDevSoundToneRejectionTest::DoTimerCallback()
  1.5927 +	{
  1.5928 +	INFO_PRINTF1(_L("TimerEvent called"));
  1.5929 +	iTimer->Cancel();
  1.5930 +	INFO_PRINTF1(_L("DevSound Event: EEventTimerComplete"));
  1.5931 +	Fsm(EEventTimerComplete, KErrNone);
  1.5932 +	}
  1.5933 +
  1.5934 +void RA3FDevSoundToneRejectionTest::ToneFinished(TInt aError)
  1.5935 +	{
  1.5936 +	INFO_PRINTF1(_L("========== DevSound ToneFinished() callback =========="));
  1.5937 +	if (aError == KErrUnderflow)
  1.5938 +		{
  1.5939 +		INFO_PRINTF2(_L("First DevSound instance called ToneFinished with error = %d"), aError);
  1.5940 +		StopTest(aError,EPass);
  1.5941 +		}
  1.5942 +	else
  1.5943 +		{
  1.5944 +		ERR_PRINTF2(_L("First DevSound instance called ToneFinished with error = %d that was NOT expected"), aError);
  1.5945 +		ERR_PRINTF2(_L("Expected error = %d"), aError);
  1.5946 +		StopTest(aError, EFail);
  1.5947 +		}
  1.5948 +	}
  1.5949 +
  1.5950 +
  1.5951 +void RA3FDevSoundToneRejectionTest::ClientInitializeCompleteCallback(TInt aError)
  1.5952 +	{
  1.5953 +	INFO_PRINTF1(_L("========== Second Client DevSound InitializeComplete() callback =========="));
  1.5954 +	if (aError != KErrNone)
  1.5955 +		{
  1.5956 +		ERR_PRINTF2(_L("Second Devsound InitializeComplete received an error = %d"), aError);
  1.5957 +		StopTest(aError);
  1.5958 +		}
  1.5959 +	else
  1.5960 +		{
  1.5961 +		INFO_PRINTF1(_L("Starting to play audio thru second devsound client"));
  1.5962 +		TInt err = iDevsoundToneClient->PlayTone();
  1.5963 +		if (err != KErrNone)
  1.5964 +			{
  1.5965 +			ERR_PRINTF2(_L("Starting to play tones thru second devsound client left with error = %d"), err);
  1.5966 +			StopTest(err);
  1.5967 +			}
  1.5968 +		}
  1.5969 +	}
  1.5970 +
  1.5971 +void RA3FDevSoundToneRejectionTest::ClientToneFinishedCallback(TInt aError)
  1.5972 +	{
  1.5973 +	INFO_PRINTF1(_L("========== DevSound ToneFinished() callback =========="));
  1.5974 +	if (aError == KErrInUse || aError == KErrDied || aError == KErrAccessDenied)
  1.5975 +		{
  1.5976 +		INFO_PRINTF1(_L("========== Rejection 2nd DevSound Instance=========="));
  1.5977 +		}
  1.5978 +	else
  1.5979 +		{
  1.5980 +		ERR_PRINTF2(_L("Second DevSound client called ToneFinished() and failed with error = %d "), aError);
  1.5981 +		ERR_PRINTF4(_L("Expected posibilities %d %d %d "), KErrInUse, KErrDied, KErrAccessDenied);
  1.5982 +		StopTest(aError, EFail);
  1.5983 +		}
  1.5984 +	}
  1.5985 +
  1.5986 +/*
  1.5987 + *========================================================================================================
  1.5988 + * MM-A3F-DEVSOUND-CHRTZ-TONE-0043
  1.5989 + */
  1.5990 +RA3FDevSoundTonePlayToneOnceAndStopTest::RA3FDevSoundTonePlayToneOnceAndStopTest(const TDesC& aTestName)
  1.5991 +	:	RA3FDevSoundTestBase(aTestName),
  1.5992 +		iDuration(0), iFrequencyTone1(0),
  1.5993 +		iToneStopped(EFalse)
  1.5994 +	{
  1.5995 +	}
  1.5996 +
  1.5997 +RA3FDevSoundTonePlayToneOnceAndStopTest* RA3FDevSoundTonePlayToneOnceAndStopTest::NewL(const TDesC& aTestName)
  1.5998 +	{
  1.5999 +	RA3FDevSoundTonePlayToneOnceAndStopTest * self = new(ELeave)RA3FDevSoundTonePlayToneOnceAndStopTest(aTestName);
  1.6000 +	return self;
  1.6001 +	}
  1.6002 +
  1.6003 +void RA3FDevSoundTonePlayToneOnceAndStopTest::DoKickoffTestL()
  1.6004 +	{
  1.6005 +	if (!GetIntFromConfig(iTestStepName, KDuration, iDuration))
  1.6006 +		{
  1.6007 +		ERR_PRINTF2(KMsgErrorGetParameter, &KDuration);
  1.6008 +		StopTest(KErrNotFound);
  1.6009 +		return;
  1.6010 +		}
  1.6011 +	if (!GetIntFromConfig(iTestStepName, KFrequencyTone1, iFrequencyTone1))
  1.6012 +		{
  1.6013 +		ERR_PRINTF2(KMsgErrorGetParameter, &KFrequencyTone1);
  1.6014 +		StopTest(KErrNotFound);
  1.6015 +		return;
  1.6016 +		}
  1.6017 +	iTimer = CPeriodic::NewL(CActive::EPriorityHigh);
  1.6018 +	}
  1.6019 +
  1.6020 +void RA3FDevSoundTonePlayToneOnceAndStopTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError)
  1.6021 +	{
  1.6022 +	switch (iDevSoundState)
  1.6023 +		{
  1.6024 +		case EStateCreated:
  1.6025 +			{
  1.6026 +			__ASSERT_ALWAYS((aError == KErrNone), Panic(_L("RA3FDevSoundTonePlayToneOnceAndStopTest"), EFsmIncorrectErrorPassed));
  1.6027 +			if (aDevSoundEvent == EEventInitialize)
  1.6028 +				{
  1.6029 +				INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL"));
  1.6030 +				TRAPD(err, iMMFDevSound->InitializeL(*this,  EMMFStateTonePlaying));
  1.6031 +				if (err != KErrNone)
  1.6032 +					{
  1.6033 +					ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"),  err);
  1.6034 +					StopTest(err);
  1.6035 +					break;
  1.6036 +					}
  1.6037 +				INFO_PRINTF1(_L("DevSound State: EStateInitializing"));
  1.6038 +				iDevSoundState = EStateInitializing;
  1.6039 +				}
  1.6040 +			else
  1.6041 +				{
  1.6042 +				ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent);
  1.6043 +				StopTest(aError, EFail);
  1.6044 +				}
  1.6045 +			break;
  1.6046 +			}
  1.6047 +		case EStateInitializing:
  1.6048 +			{
  1.6049 +			if (aDevSoundEvent == EEventInitComplete && aError == KErrNone)
  1.6050 +				{
  1.6051 +				if (!iToneStopped)
  1.6052 +					{
  1.6053 +					iMMFDevSound->SetVolume(iMMFDevSound->MaxVolume());
  1.6054 +					INFO_PRINTF3(_L("Calling CMMFDevSound::PlayToneL using %d Hz during %d secs "), iFrequencyTone1, iDuration);
  1.6055 +					TRAPD(err, iMMFDevSound->PlayToneL(iFrequencyTone1, iDuration*KMicroSecsInOneSec));
  1.6056 +					if (err != KErrNone)
  1.6057 +						{
  1.6058 +						ERR_PRINTF2(_L("CMMFDevSound::PlayToneL left with error : %d!"), err);
  1.6059 +						StopTest(err);
  1.6060 +						break;
  1.6061 +						}
  1.6062 +					StartTimer(KMicroSecsTwoSec);
  1.6063 +					INFO_PRINTF1(_L("DevSound State: EStatePlaying"));
  1.6064 +					iDevSoundState = EStatePlaying;
  1.6065 +					}
  1.6066 +				else
  1.6067 +					{
  1.6068 +					INFO_PRINTF1(_L("Calling CMMFDevSound::Stop succeeded"));
  1.6069 +					StopTest(aError);
  1.6070 +					}
  1.6071 +				}
  1.6072 +			else if (aDevSoundEvent == EEventInitComplete && aError != KErrNone)
  1.6073 +				{
  1.6074 +				ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error = %d"), aError);
  1.6075 +				StopTest(aError);
  1.6076 +				}
  1.6077 +			else
  1.6078 +				{
  1.6079 +				ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent);
  1.6080 +				StopTest(aError, EFail);
  1.6081 +				}
  1.6082 +			break;
  1.6083 +			}
  1.6084 +		case EStatePlaying:
  1.6085 +			{
  1.6086 +			if(aDevSoundEvent == EEventTimerComplete)
  1.6087 +				{
  1.6088 +				INFO_PRINTF1(_L("Calling CMMFDevSound::Stop"));
  1.6089 +				iMMFDevSound->Stop();
  1.6090 +				}
  1.6091 +			else
  1.6092 +				{
  1.6093 +				ERR_PRINTF2(_L("DevSound EEventTimerComplete not received as expected. Received event: %d"), aDevSoundEvent);
  1.6094 +				StopTest(aError, EFail);
  1.6095 +				}
  1.6096 +			break;
  1.6097 +			}
  1.6098 +		default:
  1.6099 +			{
  1.6100 +			ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState);
  1.6101 +			StopTest(aError, EFail);
  1.6102 +			}
  1.6103 +		}
  1.6104 +
  1.6105 +	}
  1.6106 +
  1.6107 +void RA3FDevSoundTonePlayToneOnceAndStopTest::DoTimerCallback()
  1.6108 +	{
  1.6109 +	INFO_PRINTF1(_L("TimerEvent called"));
  1.6110 +	INFO_PRINTF1(_L("DevSound Event: EEventTimerComplete"));
  1.6111 +	if(!iToneStopped)
  1.6112 +		{
  1.6113 +		Fsm(EEventTimerComplete, KErrNone);
  1.6114 +		iToneStopped = ETrue;
  1.6115 +		}
  1.6116 +	else
  1.6117 +		{
  1.6118 +		iTimer->Cancel();
  1.6119 +		INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL"));
  1.6120 +		TRAPD(err, iMMFDevSound->InitializeL(*this, EMMFStateTonePlaying));
  1.6121 +		if (err != KErrNone)
  1.6122 +			{
  1.6123 +			ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"),  err);
  1.6124 +			ERR_PRINTF2(_L("Expected error = %d"), KErrNone);
  1.6125 +			StopTest(err);
  1.6126 +			}
  1.6127 +		INFO_PRINTF1(_L("DevSound State: EStateInitializing"));
  1.6128 +		iDevSoundState = EStateInitializing;
  1.6129 +		}
  1.6130 +	}
  1.6131 +
  1.6132 +void RA3FDevSoundTonePlayToneOnceAndStopTest::ToneFinished(TInt aError)
  1.6133 +	{
  1.6134 +	INFO_PRINTF1(_L("========== DevSound ToneFinished() callback =========="));
  1.6135 +	ERR_PRINTF1(_L("DevSound should not have called ToneFinished because it is supposed to have been stopped"));
  1.6136 +	StopTest(aError, EFail);
  1.6137 +	}
  1.6138 +
  1.6139 +
  1.6140 +/*
  1.6141 + *========================================================================================================
  1.6142 + * MM-A3F-DEVSOUND-CHRTZ-TONE-0044
  1.6143 + */
  1.6144 +RA3FDevSoundTonePlayDualToneOnceAndStopTest::RA3FDevSoundTonePlayDualToneOnceAndStopTest(const TDesC& aTestName)
  1.6145 +	:	RA3FDevSoundTestBase(aTestName),
  1.6146 +		iDuration(0), iFrequencyTone1(0),
  1.6147 +		iFrequencyTone2(0), iToneStopped(EFalse)
  1.6148 +	{
  1.6149 +	}
  1.6150 +
  1.6151 +RA3FDevSoundTonePlayDualToneOnceAndStopTest* RA3FDevSoundTonePlayDualToneOnceAndStopTest::NewL(const TDesC& aTestName)
  1.6152 +	{
  1.6153 +	RA3FDevSoundTonePlayDualToneOnceAndStopTest * self = new(ELeave)RA3FDevSoundTonePlayDualToneOnceAndStopTest(aTestName);
  1.6154 +	return self;
  1.6155 +	}
  1.6156 +
  1.6157 +void RA3FDevSoundTonePlayDualToneOnceAndStopTest::DoKickoffTestL()
  1.6158 +	{
  1.6159 +	if (!GetIntFromConfig(iTestStepName, KDuration, iDuration))
  1.6160 +		{
  1.6161 +		ERR_PRINTF2(KMsgErrorGetParameter, &KDuration);
  1.6162 +		StopTest(KErrNotFound);
  1.6163 +		return;
  1.6164 +		}
  1.6165 +	if (!GetIntFromConfig(iTestStepName, KFrequencyTone1, iFrequencyTone1))
  1.6166 +		{
  1.6167 +		ERR_PRINTF2(KMsgErrorGetParameter, &KFrequencyTone1);
  1.6168 +		StopTest(KErrNotFound);
  1.6169 +		return;
  1.6170 +		}
  1.6171 +	if (!GetIntFromConfig(iTestStepName, KFrequencyTone2, iFrequencyTone2))
  1.6172 +		{
  1.6173 +		ERR_PRINTF2(KMsgErrorGetParameter, &KFrequencyTone2);
  1.6174 +		StopTest(KErrNotFound);
  1.6175 +		return;
  1.6176 +		}
  1.6177 +	iTimer = CPeriodic::NewL(CActive::EPriorityHigh);
  1.6178 +	}
  1.6179 +
  1.6180 +void RA3FDevSoundTonePlayDualToneOnceAndStopTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError)
  1.6181 +	{
  1.6182 +	switch (iDevSoundState)
  1.6183 +		{
  1.6184 +		case EStateCreated:
  1.6185 +			{
  1.6186 +			__ASSERT_ALWAYS((aError == KErrNone), Panic(_L("RA3FDevSoundTonePlayDualToneOnceAndStopTest"), EFsmIncorrectErrorPassed));
  1.6187 +			if (aDevSoundEvent == EEventInitialize)
  1.6188 +				{
  1.6189 +				INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL"));
  1.6190 +				TRAPD(err, iMMFDevSound->InitializeL(*this, EMMFStateTonePlaying));
  1.6191 +				if (err != KErrNone)
  1.6192 +					{
  1.6193 +					ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"),  err);
  1.6194 +					StopTest(err);
  1.6195 +					break;
  1.6196 +					}
  1.6197 +				INFO_PRINTF1(_L("DevSound State: EStateInitializing"));
  1.6198 +				iDevSoundState = EStateInitializing;
  1.6199 +				}
  1.6200 +			else
  1.6201 +				{
  1.6202 +				ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent);
  1.6203 +				StopTest(aError, EFail);
  1.6204 +				}
  1.6205 +			break;
  1.6206 +			}
  1.6207 +		case EStateInitializing:
  1.6208 +			{
  1.6209 +			if (aDevSoundEvent == EEventInitComplete && aError == KErrNone)
  1.6210 +				{
  1.6211 +				if (!iToneStopped)
  1.6212 +					{
  1.6213 +					iMMFDevSound->SetVolume(iMMFDevSound->MaxVolume());
  1.6214 +					INFO_PRINTF4(_L("Calling CMMFDevSound::PlayDualToneL using %d Hz %d Hz during %d secs "), iFrequencyTone1, iFrequencyTone2, iDuration);
  1.6215 +					TRAPD(err, iMMFDevSound->PlayDualToneL(iFrequencyTone1, iFrequencyTone2, iDuration*KMicroSecsInOneSec));
  1.6216 +					if (err != KErrNone)
  1.6217 +						{
  1.6218 +						ERR_PRINTF2(_L("CMMFDevSound::PlayDualToneL left with error = %d!"),  err);
  1.6219 +						StopTest(err);
  1.6220 +						break;
  1.6221 +						}
  1.6222 +					StartTimer(KMicroSecsTwoSec);
  1.6223 +					INFO_PRINTF1(_L("DevSound State: EStatePlaying"));
  1.6224 +					iDevSoundState = EStatePlaying;
  1.6225 +					}
  1.6226 +				else
  1.6227 +					{
  1.6228 +					INFO_PRINTF1(_L("Calling CMMFDevSound::Stop succeeded"));
  1.6229 +					StopTest(aError);
  1.6230 +					}
  1.6231 +				}
  1.6232 +			else if (aDevSoundEvent == EEventInitComplete && aError != KErrNone)
  1.6233 +				{
  1.6234 +				ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error = %d"), aError);
  1.6235 +				StopTest(aError);
  1.6236 +				}
  1.6237 +			else
  1.6238 +				{
  1.6239 +				ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent);
  1.6240 +				StopTest(aError, EFail);
  1.6241 +				}
  1.6242 +			break;
  1.6243 +			}
  1.6244 +		case EStatePlaying:
  1.6245 +			{
  1.6246 +			if(aDevSoundEvent == EEventTimerComplete)
  1.6247 +				{
  1.6248 +				INFO_PRINTF1(_L("Calling CMMFDevSound::Stop"));
  1.6249 +				iMMFDevSound->Stop();
  1.6250 +				}
  1.6251 +			else
  1.6252 +				{
  1.6253 +				ERR_PRINTF2(_L("DevSound EEventTimerComplete not received as expected. Received event: %d"), aDevSoundEvent);
  1.6254 +				StopTest(aError, EFail);
  1.6255 +				}
  1.6256 +			break;
  1.6257 +			}
  1.6258 +		default:
  1.6259 +			{
  1.6260 +			ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState);
  1.6261 +			StopTest(aError, EFail);
  1.6262 +			}
  1.6263 +		}
  1.6264 +	}
  1.6265 +
  1.6266 +void RA3FDevSoundTonePlayDualToneOnceAndStopTest::DoTimerCallback()
  1.6267 +	{
  1.6268 +	INFO_PRINTF1(_L("TimerEvent called"));
  1.6269 +	INFO_PRINTF1(_L("DevSound Event: EEventTimerComplete"));
  1.6270 +	if(!iToneStopped)
  1.6271 +		{
  1.6272 +		Fsm(EEventTimerComplete, KErrNone);
  1.6273 +		iToneStopped = ETrue;
  1.6274 +		}
  1.6275 +	else
  1.6276 +		{
  1.6277 +		iTimer->Cancel();
  1.6278 +		INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL"));
  1.6279 +		TRAPD(err, iMMFDevSound->InitializeL(*this, EMMFStateTonePlaying));
  1.6280 +		if (err != KErrNone)
  1.6281 +			{
  1.6282 +			ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"),  err);
  1.6283 +			ERR_PRINTF2(_L("Expected error = %d"), KErrNone);
  1.6284 +			StopTest(err);
  1.6285 +			}
  1.6286 +		INFO_PRINTF1(_L("DevSound State: EStateInitializing"));
  1.6287 +		iDevSoundState = EStateInitializing;
  1.6288 +		}
  1.6289 +	}
  1.6290 +
  1.6291 +void RA3FDevSoundTonePlayDualToneOnceAndStopTest::ToneFinished(TInt aError)
  1.6292 +	{
  1.6293 +	INFO_PRINTF1(_L("========== DevSound ToneFinished() callback =========="));
  1.6294 +	ERR_PRINTF1(_L("DevSound should not have called ToneFinished because it is supposed to have been stopped"));
  1.6295 +	StopTest(aError, EFail);
  1.6296 +	}
  1.6297 +
  1.6298 +/*
  1.6299 + *========================================================================================================
  1.6300 + * MM-A3F-DEVSOUND-CHRTZ-TONE-0045
  1.6301 + */
  1.6302 +RA3FDevSoundTonePlayDTMFStringOnceAndStopTest::RA3FDevSoundTonePlayDTMFStringOnceAndStopTest(const TDesC& aTestName)
  1.6303 +	:	RA3FDevSoundTestBase(aTestName),iDTMFString(KNullDesC),
  1.6304 +		iToneStopped(EFalse)
  1.6305 +	{
  1.6306 +	}
  1.6307 +
  1.6308 +RA3FDevSoundTonePlayDTMFStringOnceAndStopTest* RA3FDevSoundTonePlayDTMFStringOnceAndStopTest::NewL(const TDesC& aTestName)
  1.6309 +	{
  1.6310 +	RA3FDevSoundTonePlayDTMFStringOnceAndStopTest * self = new(ELeave)RA3FDevSoundTonePlayDTMFStringOnceAndStopTest(aTestName);
  1.6311 +	return self;
  1.6312 +	}
  1.6313 +
  1.6314 +void RA3FDevSoundTonePlayDTMFStringOnceAndStopTest::DoKickoffTestL()
  1.6315 +	{
  1.6316 +	TPtrC DTMF;
  1.6317 +	if ( !GetStringFromConfig(iTestStepName, KDTMFString, DTMF) )
  1.6318 +		{
  1.6319 +		ERR_PRINTF2(KMsgErrorGetParameter, &KDTMFString);
  1.6320 +		StopTest(KErrNotFound);
  1.6321 +		return;
  1.6322 +		}
  1.6323 +	iDTMFString.Copy(DTMF);
  1.6324 +	iTimer = CPeriodic::NewL(CActive::EPriorityHigh);
  1.6325 +	}
  1.6326 +
  1.6327 +void RA3FDevSoundTonePlayDTMFStringOnceAndStopTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError)
  1.6328 +	{
  1.6329 +	switch(iDevSoundState)
  1.6330 +		{
  1.6331 +		case EStateCreated:
  1.6332 +			{
  1.6333 +			__ASSERT_ALWAYS((aError == KErrNone), Panic(_L("RA3FDevSoundTonePlayDTMFStringOnceAndStopTest"), EFsmIncorrectErrorPassed));
  1.6334 +			if (aDevSoundEvent == EEventInitialize)
  1.6335 +				{
  1.6336 +				INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL"));
  1.6337 +				TRAPD(err, iMMFDevSound->InitializeL(*this, EMMFStateTonePlaying));
  1.6338 +				if (err != KErrNone)
  1.6339 +					{
  1.6340 +					ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err);
  1.6341 +					StopTest(err);
  1.6342 +					break;
  1.6343 +					}
  1.6344 +				INFO_PRINTF1(_L("DevSound State: EStateInitializing"));
  1.6345 +				iDevSoundState = EStateInitializing;
  1.6346 +				}
  1.6347 +			else
  1.6348 +				{
  1.6349 +				ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent);
  1.6350 +				StopTest(aError, EFail);
  1.6351 +				}
  1.6352 +			break;
  1.6353 +			}
  1.6354 +		case EStateInitializing:
  1.6355 +			{
  1.6356 +			if (aDevSoundEvent == EEventInitComplete && aError == KErrNone)
  1.6357 +				{
  1.6358 +				if (!iToneStopped)
  1.6359 +					{
  1.6360 +					iMMFDevSound->SetVolume(iMMFDevSound->MaxVolume());
  1.6361 +					INFO_PRINTF2(_L("Calling CMMFDevSound::PlayDTMFStringL %S"), &iDTMFString);
  1.6362 +					TRAPD(err, iMMFDevSound->PlayDTMFStringL(iDTMFString));
  1.6363 +					if (err != KErrNone)
  1.6364 +						{
  1.6365 +						ERR_PRINTF2(_L("CMMFDevSound::PlayDTMFStringL left with error = %d"), err);
  1.6366 +						StopTest(err);
  1.6367 +						break;
  1.6368 +						}
  1.6369 +					StartTimer(KMicroSecsTwoSec);
  1.6370 +					INFO_PRINTF1(_L("DevSound State: EStatePlaying"));
  1.6371 +					iDevSoundState = EStatePlaying;
  1.6372 +					}
  1.6373 +				else
  1.6374 +					{
  1.6375 +					INFO_PRINTF1(_L("Calling CMMFDevSound::Stop succeeded"));
  1.6376 +					StopTest(aError);
  1.6377 +					}
  1.6378 +				}
  1.6379 +			else if (aDevSoundEvent == EEventInitComplete && aError != KErrNone)
  1.6380 +				{
  1.6381 +				ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error = %d"), aError);
  1.6382 +				StopTest(aError);
  1.6383 +				}
  1.6384 +			else
  1.6385 +				{
  1.6386 +				ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent);
  1.6387 +				StopTest(aError, EFail);
  1.6388 +				}
  1.6389 +			break;
  1.6390 +			}
  1.6391 +		case EStatePlaying:
  1.6392 +			{
  1.6393 +			if(aDevSoundEvent == EEventTimerComplete)
  1.6394 +				{
  1.6395 +				INFO_PRINTF1(_L("Calling CMMFDevSound::Stop"));
  1.6396 +				iMMFDevSound->Stop();
  1.6397 +				}
  1.6398 +			else
  1.6399 +				{
  1.6400 +				ERR_PRINTF2(_L("DevSound EEventTimerComplete not received as expected. Received event: %d"), aDevSoundEvent);
  1.6401 +				StopTest(aError, EFail);
  1.6402 +				}
  1.6403 +			break;
  1.6404 +			}
  1.6405 +		default:
  1.6406 +			{
  1.6407 +			ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState);
  1.6408 +			StopTest(aError, EFail);
  1.6409 +			}
  1.6410 +		}
  1.6411 +	}
  1.6412 +
  1.6413 +void RA3FDevSoundTonePlayDTMFStringOnceAndStopTest::DoTimerCallback()
  1.6414 +	{
  1.6415 +	INFO_PRINTF1(_L("TimerEvent called"));
  1.6416 +	INFO_PRINTF1(_L("DevSound Event: EEventTimerComplete"));
  1.6417 +	if(!iToneStopped)
  1.6418 +		{
  1.6419 +		Fsm(EEventTimerComplete, KErrNone);
  1.6420 +		iToneStopped = ETrue;
  1.6421 +		}
  1.6422 +	else
  1.6423 +		{
  1.6424 +		iTimer->Cancel();
  1.6425 +		INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL"));
  1.6426 +		TRAPD(err, iMMFDevSound->InitializeL(*this, EMMFStateTonePlaying));
  1.6427 +		if (err != KErrNone)
  1.6428 +			{
  1.6429 +			ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"),  err);
  1.6430 +			ERR_PRINTF2(_L("Expected error = %d"), KErrNone);
  1.6431 +			StopTest(err);
  1.6432 +			}
  1.6433 +		INFO_PRINTF1(_L("DevSound State: EStateInitializing"));
  1.6434 +		iDevSoundState = EStateInitializing;
  1.6435 +		}
  1.6436 +	}
  1.6437 +
  1.6438 +void RA3FDevSoundTonePlayDTMFStringOnceAndStopTest::ToneFinished(TInt aError)
  1.6439 +	{
  1.6440 +	INFO_PRINTF1(_L("========== DevSound ToneFinished() callback =========="));
  1.6441 +	ERR_PRINTF1(_L("DevSound should not have called ToneFinished because it is supposed to have been stopped"));
  1.6442 +	StopTest(aError, EFail);
  1.6443 +	}
  1.6444 +/*
  1.6445 + *========================================================================================================
  1.6446 + * MM-A3F-DEVSOUND-CHRTZ-TONE-0046
  1.6447 + */
  1.6448 +RA3FDevSoundTonePlayToneSequenceOnceAndStopTest::RA3FDevSoundTonePlayToneSequenceOnceAndStopTest(const TDesC& aTestName)
  1.6449 +	:	RA3FDevSoundTestBase(aTestName), iToneStopped(EFalse)
  1.6450 +	{
  1.6451 +	}
  1.6452 +
  1.6453 +RA3FDevSoundTonePlayToneSequenceOnceAndStopTest* RA3FDevSoundTonePlayToneSequenceOnceAndStopTest::NewL(const TDesC& aTestName)
  1.6454 +	{
  1.6455 +	RA3FDevSoundTonePlayToneSequenceOnceAndStopTest * self = new(ELeave)RA3FDevSoundTonePlayToneSequenceOnceAndStopTest(aTestName);
  1.6456 +	return self;
  1.6457 +	}
  1.6458 +
  1.6459 +void RA3FDevSoundTonePlayToneSequenceOnceAndStopTest::DoKickoffTestL()
  1.6460 +	{
  1.6461 +	iTimer = CPeriodic::NewL(CActive::EPriorityHigh);
  1.6462 +	}
  1.6463 +
  1.6464 +void RA3FDevSoundTonePlayToneSequenceOnceAndStopTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError)
  1.6465 +	{
  1.6466 +	switch (iDevSoundState)
  1.6467 +		{
  1.6468 +		case EStateCreated:
  1.6469 +			{
  1.6470 +			__ASSERT_ALWAYS((aError == KErrNone), Panic(_L("RA3FDevSoundTonePlayToneSequenceOnceAndStopTest"), EFsmIncorrectErrorPassed));
  1.6471 +			if (aDevSoundEvent == EEventInitialize)
  1.6472 +				{
  1.6473 +				INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL"));
  1.6474 +				TRAPD(err, iMMFDevSound->InitializeL(*this, EMMFStateTonePlaying));
  1.6475 +				if (err != KErrNone)
  1.6476 +					{
  1.6477 +					ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"),  err);
  1.6478 +					StopTest(err);
  1.6479 +					break;
  1.6480 +					}
  1.6481 +				INFO_PRINTF1(_L("DevSound State: EStateInitializing"));
  1.6482 +				iDevSoundState = EStateInitializing;
  1.6483 +				}
  1.6484 +			else
  1.6485 +				{
  1.6486 +				ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent);
  1.6487 +				StopTest(aError, EFail);
  1.6488 +				}
  1.6489 +			break;
  1.6490 +			}
  1.6491 +		case EStateInitializing:
  1.6492 +			{
  1.6493 +			if (aDevSoundEvent == EEventInitComplete && aError == KErrNone)
  1.6494 +				{
  1.6495 +				if (!iToneStopped)
  1.6496 +					{
  1.6497 +					iMMFDevSound->SetVolume(iMMFDevSound->MaxVolume());
  1.6498 +					TUint8* tablePointer = const_cast<TUint8*>( &(KFixedSequenceTestSequenceDataX[0]));
  1.6499 +					TPtrC8 KFixedSequenceData(tablePointer,  sizeof(KFixedSequenceTestSequenceDataX));
  1.6500 +					INFO_PRINTF1(_L("Calling CMMFDevSound::PlayToneSequenceL"));
  1.6501 +					TRAPD(err, iMMFDevSound->PlayToneSequenceL(KFixedSequenceData));
  1.6502 +					if (err != KErrNone)
  1.6503 +						{
  1.6504 +						ERR_PRINTF2(_L("CMMFDevSound::PlayToneSequenceL left with error = %d!"), err);
  1.6505 +						StopTest(err);
  1.6506 +						break;
  1.6507 +						}
  1.6508 +					StartTimer(KMicroSecsTwoSec);
  1.6509 +					INFO_PRINTF1(_L("DevSound State: EStatePlaying"));
  1.6510 +					iDevSoundState = EStatePlaying;
  1.6511 +					}
  1.6512 +				else
  1.6513 +					{
  1.6514 +					INFO_PRINTF1(_L("Calling CMMFDevSound::Stop succeeded"));
  1.6515 +					StopTest(aError);
  1.6516 +					}
  1.6517 +
  1.6518 +				}
  1.6519 +			else if (aDevSoundEvent == EEventInitComplete && aError != KErrNone)
  1.6520 +				{
  1.6521 +				ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error = %d"), aError);
  1.6522 +				StopTest(aError);
  1.6523 +				}
  1.6524 +			else
  1.6525 +				{
  1.6526 +				ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent);
  1.6527 +				StopTest(aError, EFail);
  1.6528 +				}
  1.6529 +			break;
  1.6530 +			}
  1.6531 +		case EStatePlaying:
  1.6532 +			{
  1.6533 +			if(aDevSoundEvent == EEventTimerComplete)
  1.6534 +				{
  1.6535 +				INFO_PRINTF1(_L("Calling CMMFDevSound::Stop"));
  1.6536 +				iMMFDevSound->Stop();
  1.6537 +				}
  1.6538 +			else
  1.6539 +				{
  1.6540 +				ERR_PRINTF2(_L("DevSound EEventTimerComplete not received as expected. Received event: %d"), aDevSoundEvent);
  1.6541 +				StopTest(aError, EFail);
  1.6542 +				}
  1.6543 +			break;
  1.6544 +			}
  1.6545 +		default:
  1.6546 +			{
  1.6547 +			ERR_PRINTF2(_L("Invalid DevSound state received: %d"),  iDevSoundState);
  1.6548 +			StopTest(aError, EFail);
  1.6549 +			}
  1.6550 +		}
  1.6551 +	}
  1.6552 +
  1.6553 +void RA3FDevSoundTonePlayToneSequenceOnceAndStopTest::DoTimerCallback()
  1.6554 +	{
  1.6555 +	INFO_PRINTF1(_L("TimerEvent called"));
  1.6556 +	INFO_PRINTF1(_L("DevSound Event: EEventTimerComplete"));
  1.6557 +	if(!iToneStopped)
  1.6558 +		{
  1.6559 +		Fsm(EEventTimerComplete, KErrNone);
  1.6560 +		iToneStopped = ETrue;
  1.6561 +		}
  1.6562 +	else
  1.6563 +		{
  1.6564 +		iTimer->Cancel();
  1.6565 +		INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL"));
  1.6566 +		TRAPD(err, iMMFDevSound->InitializeL(*this, EMMFStateTonePlaying));
  1.6567 +		if (err != KErrNone)
  1.6568 +			{
  1.6569 +			ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"),  err);
  1.6570 +			ERR_PRINTF2(_L("Expected error = %d"), KErrNone);
  1.6571 +			StopTest(err);
  1.6572 +			}
  1.6573 +		INFO_PRINTF1(_L("DevSound State: EStateInitializing"));
  1.6574 +		iDevSoundState = EStateInitializing;
  1.6575 +		}
  1.6576 +	}
  1.6577 +
  1.6578 +void RA3FDevSoundTonePlayToneSequenceOnceAndStopTest::ToneFinished(TInt aError)
  1.6579 +	{
  1.6580 +	INFO_PRINTF1(_L("========== DevSound ToneFinished() callback =========="));
  1.6581 +	ERR_PRINTF1(_L("DevSound should not have called ToneFinished because it is supposed to have been stopped"));
  1.6582 +	StopTest(aError, EFail);
  1.6583 +	}
  1.6584 +
  1.6585 +/*
  1.6586 + *========================================================================================================
  1.6587 + * MM-A3F-DEVSOUND-CHRTZ-TONE-0047
  1.6588 + */
  1.6589 +RA3FDevSoundTonePlayToneOncePauseTest::RA3FDevSoundTonePlayToneOncePauseTest(const TDesC& aTestName)
  1.6590 +	:	RA3FDevSoundTestBase(aTestName),iDuration(0),
  1.6591 +		iFrequencyTone1(0), iPaused(EFalse),
  1.6592 +		iSamplesPlayedPaused(0)
  1.6593 +	{
  1.6594 +	}
  1.6595 +
  1.6596 +RA3FDevSoundTonePlayToneOncePauseTest* RA3FDevSoundTonePlayToneOncePauseTest::NewL(const TDesC& aTestName)
  1.6597 +	{
  1.6598 +	RA3FDevSoundTonePlayToneOncePauseTest * self = new(ELeave)RA3FDevSoundTonePlayToneOncePauseTest(aTestName);
  1.6599 +	return self;
  1.6600 +	}
  1.6601 +
  1.6602 +void RA3FDevSoundTonePlayToneOncePauseTest::DoKickoffTestL()
  1.6603 +	{
  1.6604 +	if (!GetIntFromConfig(iTestStepName, KDuration, iDuration))
  1.6605 +		{
  1.6606 +		ERR_PRINTF2(KMsgErrorGetParameter, &KDuration);
  1.6607 +		StopTest(KErrNotFound);
  1.6608 +		return;
  1.6609 +		}
  1.6610 +	if (!GetIntFromConfig(iTestStepName, KFrequencyTone1, iFrequencyTone1))
  1.6611 +		{
  1.6612 +		ERR_PRINTF2(KMsgErrorGetParameter, &KFrequencyTone1);
  1.6613 +		StopTest(KErrNotFound);
  1.6614 +		return;
  1.6615 +		}
  1.6616 +	iTimer = CPeriodic::NewL(CActive::EPriorityHigh);
  1.6617 +	}
  1.6618 +
  1.6619 +void RA3FDevSoundTonePlayToneOncePauseTest::Fsm(TMmfDevSoundEvent aDevSoundEvent,  TInt aError)
  1.6620 +	{
  1.6621 +	switch (iDevSoundState)
  1.6622 +		{
  1.6623 +		case EStateCreated:
  1.6624 +			{
  1.6625 +			__ASSERT_ALWAYS((aError == KErrNone), Panic(_L("RA3FDevSoundTonePlayToneOncePauseTest"), EFsmIncorrectErrorPassed));
  1.6626 +			if (aDevSoundEvent == EEventInitialize)
  1.6627 +				{
  1.6628 +				INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL"));
  1.6629 +				TRAPD(err, iMMFDevSound->InitializeL(*this, EMMFStateTonePlaying));
  1.6630 +				if (err != KErrNone)
  1.6631 +					{
  1.6632 +					ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"),  err);
  1.6633 +					StopTest(err);
  1.6634 +					break;
  1.6635 +					}
  1.6636 +				INFO_PRINTF1(_L("DevSound State: EStateInitializing"));
  1.6637 +				iDevSoundState = EStateInitializing;
  1.6638 +				}
  1.6639 +			else
  1.6640 +				{
  1.6641 +				ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent);
  1.6642 +				StopTest(aError, EFail);
  1.6643 +				}
  1.6644 +			break;
  1.6645 +			}
  1.6646 +		case EStateInitializing:
  1.6647 +			{
  1.6648 +			if (aDevSoundEvent == EEventInitComplete && aError == KErrNone)
  1.6649 +				{
  1.6650 +				iMMFDevSound->SetVolume(iMMFDevSound->MaxVolume());
  1.6651 +				INFO_PRINTF3(_L("Calling CMMFDevSound::PlayToneL using %d Hz during %d secs "), iFrequencyTone1, iDuration);
  1.6652 +				TRAPD(err, iMMFDevSound->PlayToneL(iFrequencyTone1, iDuration*KMicroSecsInOneSec));
  1.6653 +				if (err != KErrNone)
  1.6654 +					{
  1.6655 +					ERR_PRINTF2(_L("CMMFDevSound::PlayToneL left with error = %d!"),  err);
  1.6656 +					StopTest(err);
  1.6657 +					break;
  1.6658 +					}
  1.6659 +				StartTimer(KMicroSecsTwoSec);
  1.6660 +				INFO_PRINTF1(_L("DevSound State: EStatePlaying"));
  1.6661 +				iDevSoundState = EStatePlaying;
  1.6662 +				}
  1.6663 +			else if (aDevSoundEvent == EEventInitComplete && aError != KErrNone)
  1.6664 +				{
  1.6665 +				ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error = %d"), aError);
  1.6666 +				StopTest(aError);
  1.6667 +				}
  1.6668 +			else
  1.6669 +				{
  1.6670 +				ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"),  aDevSoundEvent);
  1.6671 +				StopTest(aError, EFail);
  1.6672 +				}
  1.6673 +			break;
  1.6674 +			}
  1.6675 +		case EStatePlaying:
  1.6676 +			{
  1.6677 +			if(aDevSoundEvent == EEventTimerComplete)
  1.6678 +				{
  1.6679 +				INFO_PRINTF1(_L("Calling CMMFDevSound::Pause"));
  1.6680 +				iMMFDevSound->Pause();
  1.6681 +				INFO_PRINTF1(_L("DevSound State: EStatePause"));
  1.6682 +				iDevSoundState = EStatePause;
  1.6683 +				INFO_PRINTF1(_L("Calling CMMFDevSound::SamplesPlayed"));
  1.6684 +				iSamplesPlayedPaused = iMMFDevSound->SamplesPlayed();
  1.6685 +				INFO_PRINTF2(_L("The number of samples played is %d"), iSamplesPlayedPaused);
  1.6686 +				}
  1.6687 +			else
  1.6688 +				{
  1.6689 +				ERR_PRINTF2(_L("DevSound EEventTimerComplete not received as expected. Received event: %d"), aDevSoundEvent);
  1.6690 +				StopTest(aError, EFail);
  1.6691 +				}
  1.6692 +			break;
  1.6693 +			}
  1.6694 +		case EStatePause:
  1.6695 +			{
  1.6696 +			if (aDevSoundEvent == EEventTimerComplete)
  1.6697 +				{
  1.6698 +				TInt samplesPlayed = iMMFDevSound->SamplesPlayed();
  1.6699 +				if(iSamplesPlayedPaused == samplesPlayed)
  1.6700 +					{
  1.6701 +					INFO_PRINTF2(_L("After waiting a couple of seconds, the samples played are still being the same %d"), iSamplesPlayedPaused);
  1.6702 +					StopTest();
  1.6703 +					}
  1.6704 +				else
  1.6705 +					{
  1.6706 +					ERR_PRINTF2(_L("After waiting a couple of seconds, the samples played are not the same %d"), samplesPlayed);
  1.6707 +					ERR_PRINTF2(_L("Expected samples played = %d"), iSamplesPlayedPaused);
  1.6708 +					StopTest(aError,EFail);
  1.6709 +					}
  1.6710 +				}
  1.6711 +			else
  1.6712 +				{
  1.6713 +				ERR_PRINTF2(_L("EEventTimerComplete not received as expected. Received event: %d"), aDevSoundEvent);
  1.6714 +				StopTest(aError, EFail);
  1.6715 +				}
  1.6716 +			break;
  1.6717 +			}
  1.6718 +		default:
  1.6719 +			{
  1.6720 +			ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState);
  1.6721 +			StopTest(aError, EFail);
  1.6722 +			}
  1.6723 +		}
  1.6724 +	}
  1.6725 +
  1.6726 +void RA3FDevSoundTonePlayToneOncePauseTest::DoTimerCallback()
  1.6727 +	{
  1.6728 +	INFO_PRINTF1(_L("TimerEvent called"));
  1.6729 +	if (!iPaused)
  1.6730 +		{
  1.6731 +		INFO_PRINTF1(_L("DevSound Event: EEventTimerComplete"));
  1.6732 +		Fsm(EEventTimerComplete, KErrNone);
  1.6733 +		iPaused = ETrue;
  1.6734 +		}
  1.6735 +	else
  1.6736 +		{
  1.6737 +		iTimer->Cancel();
  1.6738 +		INFO_PRINTF1(_L("DevSound Event: EEventTimerComplete"));
  1.6739 +		Fsm(EEventTimerComplete, KErrNone);
  1.6740 +		}
  1.6741 +	}
  1.6742 +
  1.6743 +void RA3FDevSoundTonePlayToneOncePauseTest::ToneFinished(TInt aError)
  1.6744 +	{
  1.6745 +	INFO_PRINTF1(_L("========== DevSound ToneFinished() callback =========="));
  1.6746 +	ERR_PRINTF1(_L("DevSound should not have called ToneFinished because it is supposed to be paused"));
  1.6747 +	StopTest(aError, EFail);
  1.6748 +	}
  1.6749 +
  1.6750 +/*
  1.6751 + *========================================================================================================
  1.6752 + * MM-A3F-DEVSOUND-CHRTZ-TONE-0048
  1.6753 + */
  1.6754 +RA3FDevSoundTonePlayDualToneOncePauseTest::RA3FDevSoundTonePlayDualToneOncePauseTest(const TDesC& aTestName)
  1.6755 +	:	RA3FDevSoundTestBase(aTestName),
  1.6756 +		iDuration(0),iFrequencyTone1(0),
  1.6757 +		iFrequencyTone2(0), iPaused(EFalse),
  1.6758 +		iSamplesPlayedPaused(0)
  1.6759 +	{
  1.6760 +	}
  1.6761 +
  1.6762 +RA3FDevSoundTonePlayDualToneOncePauseTest* RA3FDevSoundTonePlayDualToneOncePauseTest::NewL(const TDesC& aTestName)
  1.6763 +	{
  1.6764 +	RA3FDevSoundTonePlayDualToneOncePauseTest * self = new(ELeave)RA3FDevSoundTonePlayDualToneOncePauseTest(aTestName);
  1.6765 +	return self;
  1.6766 +	}
  1.6767 +
  1.6768 +void RA3FDevSoundTonePlayDualToneOncePauseTest::DoKickoffTestL()
  1.6769 +	{
  1.6770 +	if (!GetIntFromConfig(iTestStepName, KDuration, iDuration))
  1.6771 +		{
  1.6772 +		ERR_PRINTF2(KMsgErrorGetParameter, &KDuration);
  1.6773 +		StopTest(KErrNotFound);
  1.6774 +		return;
  1.6775 +		}
  1.6776 +	if (!GetIntFromConfig(iTestStepName, KFrequencyTone1, iFrequencyTone1))
  1.6777 +		{
  1.6778 +		ERR_PRINTF2(KMsgErrorGetParameter, &KFrequencyTone1);
  1.6779 +		StopTest(KErrNotFound);
  1.6780 +		return;
  1.6781 +		}
  1.6782 +	if (!GetIntFromConfig(iTestStepName, KFrequencyTone2, iFrequencyTone2))
  1.6783 +		{
  1.6784 +		ERR_PRINTF2(KMsgErrorGetParameter, &KFrequencyTone2);
  1.6785 +		StopTest(KErrNotFound);
  1.6786 +		return;
  1.6787 +		}
  1.6788 +	iTimer = CPeriodic::NewL(CActive::EPriorityHigh);
  1.6789 +	}
  1.6790 +
  1.6791 +void RA3FDevSoundTonePlayDualToneOncePauseTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError)
  1.6792 +	{
  1.6793 +	switch (iDevSoundState)
  1.6794 +		{
  1.6795 +		case EStateCreated:
  1.6796 +			{
  1.6797 +			__ASSERT_ALWAYS((aError == KErrNone), Panic(_L("RA3FDevSoundTonePlayDualToneOncePauseTest"), EFsmIncorrectErrorPassed));
  1.6798 +			if (aDevSoundEvent == EEventInitialize)
  1.6799 +				{
  1.6800 +				INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL"));
  1.6801 +				TRAPD(err, iMMFDevSound->InitializeL(*this,  EMMFStateTonePlaying));
  1.6802 +				if (err != KErrNone)
  1.6803 +					{
  1.6804 +					ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err);
  1.6805 +					StopTest(err);
  1.6806 +					break;
  1.6807 +					}
  1.6808 +				INFO_PRINTF1(_L("DevSound State: EStateInitializing"));
  1.6809 +				iDevSoundState = EStateInitializing;
  1.6810 +				}
  1.6811 +			else
  1.6812 +				{
  1.6813 +				ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent);
  1.6814 +				StopTest(aError, EFail);
  1.6815 +				}
  1.6816 +			break;
  1.6817 +			}
  1.6818 +		case EStateInitializing:
  1.6819 +			{
  1.6820 +			if (aDevSoundEvent == EEventInitComplete && aError == KErrNone)
  1.6821 +				{
  1.6822 +				iMMFDevSound->SetVolume(iMMFDevSound->MaxVolume());
  1.6823 +				INFO_PRINTF4(_L("Calling CMMFDevSound::PlayDualToneL using %d Hz %d Hz during %d secs "), iFrequencyTone1, iFrequencyTone2, iDuration);
  1.6824 +				TRAPD(err, iMMFDevSound->PlayDualToneL(iFrequencyTone1, iFrequencyTone2, iDuration*KMicroSecsInOneSec));
  1.6825 +				if (err != KErrNone)
  1.6826 +					{
  1.6827 +					ERR_PRINTF2(_L("CMMFDevSound::PlayDualToneL left with error : %d!"),  err);
  1.6828 +					StopTest(err);
  1.6829 +					break;
  1.6830 +					}
  1.6831 +				StartTimer(KMicroSecsTwoSec);
  1.6832 +				INFO_PRINTF1(_L("DevSound State: EStatePlaying"));
  1.6833 +				iDevSoundState = EStatePlaying;
  1.6834 +				}
  1.6835 +			else if (aDevSoundEvent == EEventInitComplete && aError != KErrNone)
  1.6836 +				{
  1.6837 +				ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error = %d"), aError);
  1.6838 +				StopTest(aError);
  1.6839 +				}
  1.6840 +			else
  1.6841 +				{
  1.6842 +				ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent);
  1.6843 +				StopTest(aError, EFail);
  1.6844 +				}
  1.6845 +			break;
  1.6846 +			}
  1.6847 +		case EStatePlaying:
  1.6848 +			{
  1.6849 +			if(aDevSoundEvent == EEventTimerComplete)
  1.6850 +				{
  1.6851 +				INFO_PRINTF1(_L("Calling CMMFDevSound::Pause"));
  1.6852 +				iMMFDevSound->Pause();
  1.6853 +				INFO_PRINTF1(_L("DevSound State: EStatePause"));
  1.6854 +				iDevSoundState = EStatePause;
  1.6855 +				INFO_PRINTF1(_L("Calling CMMFDevSound::SamplesPlayed"));
  1.6856 +				iSamplesPlayedPaused = iMMFDevSound->SamplesPlayed();
  1.6857 +				INFO_PRINTF2(_L("The number of samples played is %d"), iSamplesPlayedPaused);
  1.6858 +				StopTest();
  1.6859 +				}
  1.6860 +			else
  1.6861 +				{
  1.6862 +				ERR_PRINTF2(_L("DevSound EEventTimerComplete not received as expected. Received event: %d"), aDevSoundEvent);
  1.6863 +				StopTest(aError, EFail);
  1.6864 +				}
  1.6865 +			break;
  1.6866 +			}
  1.6867 +		case EStatePause:
  1.6868 +			{
  1.6869 +			if (aDevSoundEvent == EEventTimerComplete)
  1.6870 +				{
  1.6871 +				TInt samplesPlayed = iMMFDevSound->SamplesPlayed();
  1.6872 +				if(iSamplesPlayedPaused == samplesPlayed)
  1.6873 +					{
  1.6874 +					INFO_PRINTF2(_L("After waiting a couple of seconds, the samples played are still being the same %d"), iSamplesPlayedPaused);
  1.6875 +					StopTest();
  1.6876 +					}
  1.6877 +				else
  1.6878 +					{
  1.6879 +					ERR_PRINTF2(_L("After waiting a couple of seconds, the samples played are not the same %d"), samplesPlayed);
  1.6880 +					ERR_PRINTF2(_L("Expected samples played = %d"), iSamplesPlayedPaused);
  1.6881 +					StopTest(aError,EFail);
  1.6882 +					}
  1.6883 +				}
  1.6884 +			else
  1.6885 +				{
  1.6886 +				ERR_PRINTF2(_L("EEventTimerComplete not received as expected. Received event: %d"), aDevSoundEvent);
  1.6887 +				StopTest(aError, EFail);
  1.6888 +				}
  1.6889 +			break;
  1.6890 +			}
  1.6891 +		default:
  1.6892 +			{
  1.6893 +			ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState);
  1.6894 +			StopTest(aError, EFail);
  1.6895 +			}
  1.6896 +		}
  1.6897 +	}
  1.6898 +
  1.6899 +void RA3FDevSoundTonePlayDualToneOncePauseTest::DoTimerCallback()
  1.6900 +	{
  1.6901 +	INFO_PRINTF1(_L("TimerEvent called"));
  1.6902 +	if (!iPaused)
  1.6903 +		{
  1.6904 +		INFO_PRINTF1(_L("DevSound Event: EEventTimerComplete"));
  1.6905 +		Fsm(EEventTimerComplete, KErrNone);
  1.6906 +		iPaused = ETrue;
  1.6907 +		}
  1.6908 +	else
  1.6909 +		{
  1.6910 +		iTimer->Cancel();
  1.6911 +		INFO_PRINTF1(_L("DevSound Event: EEventTimerComplete"));
  1.6912 +		Fsm(EEventTimerComplete, KErrNone);
  1.6913 +		}
  1.6914 +	}
  1.6915 +
  1.6916 +void RA3FDevSoundTonePlayDualToneOncePauseTest::ToneFinished(TInt aError)
  1.6917 +	{
  1.6918 +	INFO_PRINTF1(_L("========== DevSound ToneFinished() callback =========="));
  1.6919 +	ERR_PRINTF1(_L("DevSound should not have called ToneFinished because it is supposed to be paused"));
  1.6920 +	StopTest(aError, EFail);
  1.6921 +	}
  1.6922 +
  1.6923 +/*
  1.6924 + *========================================================================================================
  1.6925 + * MM-A3F-DEVSOUND-CHRTZ-TONE-0049
  1.6926 + */
  1.6927 +RA3FDevSoundTonePlayDTMFStringOncePauseTest::RA3FDevSoundTonePlayDTMFStringOncePauseTest(const TDesC& aTestName)
  1.6928 +	:	RA3FDevSoundTestBase(aTestName),
  1.6929 +		iDTMFString(KNullDesC),iPaused(EFalse),
  1.6930 +		iSamplesPlayedPaused(0),iDTMFPauses(0),
  1.6931 +		iDTMFTones(0)
  1.6932 +	{
  1.6933 +	}
  1.6934 +
  1.6935 +RA3FDevSoundTonePlayDTMFStringOncePauseTest* RA3FDevSoundTonePlayDTMFStringOncePauseTest::NewL(const TDesC& aTestName)
  1.6936 +	{
  1.6937 +	RA3FDevSoundTonePlayDTMFStringOncePauseTest * self = new(ELeave)RA3FDevSoundTonePlayDTMFStringOncePauseTest(aTestName);
  1.6938 +	return self;
  1.6939 +	}
  1.6940 +
  1.6941 +void RA3FDevSoundTonePlayDTMFStringOncePauseTest::DoKickoffTestL()
  1.6942 +	{
  1.6943 +	TPtrC DTMF;
  1.6944 +	if ( !GetStringFromConfig(iTestStepName, KDTMFString, DTMF) )
  1.6945 +		{
  1.6946 +		ERR_PRINTF2(KMsgErrorGetParameter, &KDTMFString);
  1.6947 +		StopTest(KErrNotFound);
  1.6948 +		return;
  1.6949 +		}
  1.6950 +	iDTMFString.Copy(DTMF);
  1.6951 +	for(TInt i =0 ; i< iDTMFString.Length() ; i++)
  1.6952 +		{
  1.6953 +		if (iDTMFString[i] == ',')
  1.6954 +			{
  1.6955 +			iDTMFPauses++;
  1.6956 +			}
  1.6957 +		else
  1.6958 +			{
  1.6959 +			iDTMFTones++;
  1.6960 +			}
  1.6961 +		}
  1.6962 +	iTimer = CPeriodic::NewL(CActive::EPriorityHigh);
  1.6963 +	}
  1.6964 +
  1.6965 +void RA3FDevSoundTonePlayDTMFStringOncePauseTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError)
  1.6966 +	{
  1.6967 +	switch (iDevSoundState)
  1.6968 +		{
  1.6969 +		case EStateCreated:
  1.6970 +			{
  1.6971 +			__ASSERT_ALWAYS((aError == KErrNone), Panic(_L("RA3FDevSoundTonePlayDTMFStringOncePauseTest"), EFsmIncorrectErrorPassed));
  1.6972 +			if (aDevSoundEvent == EEventInitialize)
  1.6973 +				{
  1.6974 +				INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL"));
  1.6975 +				TRAPD(err, iMMFDevSound->InitializeL(*this, EMMFStateTonePlaying));
  1.6976 +				if (err != KErrNone)
  1.6977 +					{
  1.6978 +					ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err);
  1.6979 +					StopTest(err);
  1.6980 +					break;
  1.6981 +					}
  1.6982 +				INFO_PRINTF1(_L("DevSound State: EStateInitializing"));
  1.6983 +				iDevSoundState = EStateInitializing;
  1.6984 +				}
  1.6985 +			else
  1.6986 +				{
  1.6987 +				ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent);
  1.6988 +				StopTest(aError, EFail);
  1.6989 +				}
  1.6990 +			break;
  1.6991 +			}
  1.6992 +		case EStateInitializing:
  1.6993 +			{
  1.6994 +			if (aDevSoundEvent == EEventInitComplete && aError == KErrNone)
  1.6995 +				{
  1.6996 +				iMMFDevSound->SetVolume(iMMFDevSound->MaxVolume());
  1.6997 +				INFO_PRINTF2(_L("Calling CMMFDevSound::PlayDTMFStringL %S"),  &iDTMFString);
  1.6998 +				TRAPD(err, iMMFDevSound->PlayDTMFStringL(iDTMFString));
  1.6999 +				if (err != KErrNone)
  1.7000 +					{
  1.7001 +					ERR_PRINTF2(_L("CMMFDevSound::PlayDTMFStringL left with error : %d!"),  err);
  1.7002 +					StopTest(err);
  1.7003 +					}
  1.7004 +				StartTimer(KMicroSecsTwoSec);
  1.7005 +				INFO_PRINTF1(_L("DevSound State: EStatePlaying"));
  1.7006 +				iDevSoundState = EStatePlaying;
  1.7007 +				}
  1.7008 +			else if (aDevSoundEvent == EEventInitComplete && aError != KErrNone)
  1.7009 +				{
  1.7010 +				ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error = %d"), aError);
  1.7011 +				StopTest(aError);
  1.7012 +				}
  1.7013 +			else
  1.7014 +				{
  1.7015 +				ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent);
  1.7016 +				StopTest(aError, EFail);
  1.7017 +				}
  1.7018 +			break;
  1.7019 +			}
  1.7020 +		case EStatePlaying:
  1.7021 +			{
  1.7022 +			if(aDevSoundEvent == EEventTimerComplete)
  1.7023 +				{
  1.7024 +				INFO_PRINTF1(_L("Calling CMMFDevSound::Pause"));
  1.7025 +				iMMFDevSound->Pause();
  1.7026 +				INFO_PRINTF1(_L("DevSound State: EStatePause"));
  1.7027 +				iDevSoundState = EStatePause;
  1.7028 +				INFO_PRINTF1(_L("Calling CMMFDevSound::SamplesPlayed"));
  1.7029 +				iSamplesPlayedPaused = iMMFDevSound->SamplesPlayed();
  1.7030 +				INFO_PRINTF2(_L("The number of samples played is %d"), iSamplesPlayedPaused);
  1.7031 +				}
  1.7032 +			else
  1.7033 +				{
  1.7034 +				ERR_PRINTF2(_L("DevSound EEventTimerComplete not received as expected. Received event: %d"), aDevSoundEvent);
  1.7035 +				StopTest(aError, EFail);
  1.7036 +				}
  1.7037 +			break;
  1.7038 +			}
  1.7039 +		case EStatePause:
  1.7040 +			{
  1.7041 +			if (aDevSoundEvent == EEventTimerComplete)
  1.7042 +				{
  1.7043 +				TInt samplesPlayed = iMMFDevSound->SamplesPlayed();
  1.7044 +				if(iSamplesPlayedPaused == samplesPlayed)
  1.7045 +					{
  1.7046 +					INFO_PRINTF2(_L("After waiting a couple of seconds, the samples played are still being the same %d"), iSamplesPlayedPaused);
  1.7047 +					StopTest();
  1.7048 +					}
  1.7049 +				else
  1.7050 +					{
  1.7051 +					ERR_PRINTF2(_L("After waiting a couple of seconds, the samples played are not the same %d"), samplesPlayed);
  1.7052 +					ERR_PRINTF2(_L("Expected samples played = %d"), iSamplesPlayedPaused);
  1.7053 +					StopTest(aError,EFail);
  1.7054 +					}
  1.7055 +				}
  1.7056 +			else
  1.7057 +				{
  1.7058 +				ERR_PRINTF2(_L("EEventTimerComplete not received as expected. Received event: %d"), aDevSoundEvent);
  1.7059 +				StopTest(aError, EFail);
  1.7060 +				}
  1.7061 +			break;
  1.7062 +			}
  1.7063 +		default:
  1.7064 +			{
  1.7065 +			ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState);
  1.7066 +			StopTest(aError, EFail);
  1.7067 +			}
  1.7068 +		}
  1.7069 +	}
  1.7070 +
  1.7071 +void RA3FDevSoundTonePlayDTMFStringOncePauseTest::DoTimerCallback()
  1.7072 +	{
  1.7073 +	INFO_PRINTF1(_L("TimerEvent called"));
  1.7074 +	if (!iPaused)
  1.7075 +		{
  1.7076 +		INFO_PRINTF1(_L("DevSound Event: EEventTimerComplete"));
  1.7077 +		Fsm(EEventTimerComplete, KErrNone);
  1.7078 +		iPaused = ETrue;
  1.7079 +		}
  1.7080 +	else
  1.7081 +		{
  1.7082 +		iTimer->Cancel();
  1.7083 +		INFO_PRINTF1(_L("DevSound Event: EEventTimerComplete"));
  1.7084 +		Fsm(EEventTimerComplete, KErrNone);
  1.7085 +		}
  1.7086 +	}
  1.7087 +
  1.7088 +void RA3FDevSoundTonePlayDTMFStringOncePauseTest::ToneFinished(TInt aError)
  1.7089 +	{
  1.7090 +	INFO_PRINTF1(_L("========== DevSound ToneFinished() callback =========="));
  1.7091 +	ERR_PRINTF1(_L("DevSound should not have called ToneFinished because it is supposed to be paused"));
  1.7092 +	StopTest(aError, EFail);
  1.7093 +	}
  1.7094 +
  1.7095 +/*
  1.7096 + *========================================================================================================
  1.7097 + * MM-A3F-DEVSOUND-CHRTZ-TONE-0050
  1.7098 + */
  1.7099 +RA3FDevSoundTonePlayToneSequenceOncePauseTest::RA3FDevSoundTonePlayToneSequenceOncePauseTest(const TDesC& aTestName)
  1.7100 +	:	RA3FDevSoundTestBase(aTestName), iPaused(EFalse),
  1.7101 +		iSamplesPlayedPaused(0)
  1.7102 +	{
  1.7103 +	}
  1.7104 +
  1.7105 +RA3FDevSoundTonePlayToneSequenceOncePauseTest* RA3FDevSoundTonePlayToneSequenceOncePauseTest::NewL(const TDesC& aTestName)
  1.7106 +	{
  1.7107 +	RA3FDevSoundTonePlayToneSequenceOncePauseTest * self = new(ELeave)RA3FDevSoundTonePlayToneSequenceOncePauseTest(aTestName);
  1.7108 +	return self;
  1.7109 +	}
  1.7110 +
  1.7111 +void RA3FDevSoundTonePlayToneSequenceOncePauseTest::DoKickoffTestL()
  1.7112 +	{
  1.7113 +	iTimer = CPeriodic::NewL(CActive::EPriorityHigh);
  1.7114 +	}
  1.7115 +
  1.7116 +void RA3FDevSoundTonePlayToneSequenceOncePauseTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError)
  1.7117 +	{
  1.7118 +	switch(iDevSoundState)
  1.7119 +		{
  1.7120 +		case EStateCreated:
  1.7121 +			{
  1.7122 +			__ASSERT_ALWAYS((aError == KErrNone), Panic(_L("RA3FDevSoundTonePlayToneSequenceOncePauseTest"), EFsmIncorrectErrorPassed));
  1.7123 +			if (aDevSoundEvent == EEventInitialize)
  1.7124 +				{
  1.7125 +				INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL"));
  1.7126 +				TRAPD(err, iMMFDevSound->InitializeL(*this, EMMFStateTonePlaying));
  1.7127 +				if (err != KErrNone)
  1.7128 +					{
  1.7129 +					ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err);
  1.7130 +					StopTest(err);
  1.7131 +					break;
  1.7132 +					}
  1.7133 +				INFO_PRINTF1(_L("DevSound State: EStateInitializing"));
  1.7134 +				iDevSoundState = EStateInitializing;
  1.7135 +				}
  1.7136 +			else
  1.7137 +				{
  1.7138 +				ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent);
  1.7139 +				StopTest(aError, EFail);
  1.7140 +				}
  1.7141 +			break;
  1.7142 +			}
  1.7143 +		case EStateInitializing:
  1.7144 +			{
  1.7145 +			if (aDevSoundEvent == EEventInitComplete && aError == KErrNone)
  1.7146 +				{
  1.7147 +				TUint8* tablePointer = const_cast<TUint8*>( &(KFixedSequenceTestSequenceDataX[0] ) );
  1.7148 +				TPtrC8 KFixedSequenceData(tablePointer, sizeof(KFixedSequenceTestSequenceDataX));
  1.7149 +				INFO_PRINTF1(_L("Calling CMMFDevSound::PlayToneSequenceL"));
  1.7150 +				TRAPD(err, iMMFDevSound->PlayToneSequenceL(KFixedSequenceData));
  1.7151 +				if (err != KErrNone)
  1.7152 +					{
  1.7153 +					ERR_PRINTF2(_L("CMMFDevSound::PlayToneSequenceL left  with error : %d!"),  err);
  1.7154 +					StopTest(err);
  1.7155 +					break;
  1.7156 +					}
  1.7157 +				StartTimer(KMicroSecsTwoSec);
  1.7158 +				INFO_PRINTF1(_L("DevSound State: EStatePlaying"));
  1.7159 +				iDevSoundState = EStatePlaying;
  1.7160 +				}
  1.7161 +			else if (aDevSoundEvent == EEventInitComplete && aError != KErrNone)
  1.7162 +				{
  1.7163 +				ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error = %d"), aError);
  1.7164 +				StopTest(aError);
  1.7165 +				}
  1.7166 +			else
  1.7167 +				{
  1.7168 +				ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent);
  1.7169 +				StopTest(aError, EFail);
  1.7170 +				}
  1.7171 +			break;
  1.7172 +			}
  1.7173 +		case EStatePlaying:
  1.7174 +			{
  1.7175 +			if(aDevSoundEvent == EEventTimerComplete)
  1.7176 +				{
  1.7177 +				INFO_PRINTF1(_L("Calling CMMFDevSound::Pause"));
  1.7178 +				iMMFDevSound->Pause();
  1.7179 +				INFO_PRINTF1(_L("DevSound State: EStatePause"));
  1.7180 +				iDevSoundState = EStatePause;
  1.7181 +				INFO_PRINTF1(_L("Calling CMMFDevSound::SamplesPlayed"));
  1.7182 +				iSamplesPlayedPaused = iMMFDevSound->SamplesPlayed();
  1.7183 +				INFO_PRINTF2(_L("The number of samples played is %d"), iSamplesPlayedPaused);
  1.7184 +				}
  1.7185 +			else
  1.7186 +				{
  1.7187 +				ERR_PRINTF2(_L("DevSound EEventTimerComplete not received as expected. Received event: %d"), aDevSoundEvent);
  1.7188 +				StopTest(aError, EFail);
  1.7189 +				}
  1.7190 +			break;
  1.7191 +			}
  1.7192 +		case EStatePause:
  1.7193 +			{
  1.7194 +			if (aDevSoundEvent == EEventTimerComplete)
  1.7195 +				{
  1.7196 +				TInt samplesPlayed = iMMFDevSound->SamplesPlayed();
  1.7197 +				if(iSamplesPlayedPaused == samplesPlayed)
  1.7198 +					{
  1.7199 +					INFO_PRINTF2(_L("After waiting a couple of seconds, the samples played are still being the same %d"), iSamplesPlayedPaused);
  1.7200 +					StopTest();
  1.7201 +					}
  1.7202 +				else
  1.7203 +					{
  1.7204 +					ERR_PRINTF2(_L("After waiting a couple of seconds, the samples played are not the same %d"), samplesPlayed);
  1.7205 +					ERR_PRINTF2(_L("Expected samples played = %d"), iSamplesPlayedPaused);
  1.7206 +					StopTest(aError,EFail);
  1.7207 +					}
  1.7208 +				}
  1.7209 +			else
  1.7210 +				{
  1.7211 +				ERR_PRINTF2(_L("EEventTimerComplete not received as expected. Received event: %d"), aDevSoundEvent);
  1.7212 +				StopTest(aError, EFail);
  1.7213 +				}
  1.7214 +			break;
  1.7215 +			}
  1.7216 +		default:
  1.7217 +			{
  1.7218 +			ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState);
  1.7219 +			StopTest(aError, EFail);
  1.7220 +			}
  1.7221 +		}
  1.7222 +	}
  1.7223 +
  1.7224 +void RA3FDevSoundTonePlayToneSequenceOncePauseTest::DoTimerCallback()
  1.7225 +	{
  1.7226 +	INFO_PRINTF1(_L("TimerEvent called"));
  1.7227 +	if (!iPaused)
  1.7228 +		{
  1.7229 +		INFO_PRINTF1(_L("DevSound Event: EEventTimerComplete"));
  1.7230 +		Fsm(EEventTimerComplete, KErrNone);
  1.7231 +		iPaused = ETrue;
  1.7232 +		}
  1.7233 +	else
  1.7234 +		{
  1.7235 +		iTimer->Cancel();
  1.7236 +		INFO_PRINTF1(_L("DevSound Event: EEventTimerComplete"));
  1.7237 +		Fsm(EEventTimerComplete, KErrNone);
  1.7238 +		}
  1.7239 +	}
  1.7240 +
  1.7241 +void RA3FDevSoundTonePlayToneSequenceOncePauseTest::ToneFinished(TInt aError)
  1.7242 +	{
  1.7243 +	INFO_PRINTF1(_L("========== DevSound ToneFinished() callback =========="));
  1.7244 +	ERR_PRINTF1(_L("DevSound should not have called ToneFinished because it is supposed to be paused"));
  1.7245 +	StopTest(aError, EFail);
  1.7246 +	}
  1.7247 +
  1.7248 +/*
  1.7249 + *========================================================================================================
  1.7250 + * MM-A3F-DEVSOUND-CHRTZ-TONE-0051
  1.7251 + */
  1.7252 +RA3FDevSoundTonePlayToneOnceInitializedToPlayAudioTest::RA3FDevSoundTonePlayToneOnceInitializedToPlayAudioTest(const TDesC& aTestName)
  1.7253 +	:	RA3FDevSoundTestBase(aTestName), iDuration(0),
  1.7254 +		iFrequencyTone1(0)
  1.7255 +	{
  1.7256 +	}
  1.7257 +
  1.7258 +RA3FDevSoundTonePlayToneOnceInitializedToPlayAudioTest* RA3FDevSoundTonePlayToneOnceInitializedToPlayAudioTest::NewL(const TDesC& aTestName)
  1.7259 +	{
  1.7260 +	RA3FDevSoundTonePlayToneOnceInitializedToPlayAudioTest * self = new(ELeave)RA3FDevSoundTonePlayToneOnceInitializedToPlayAudioTest(aTestName);
  1.7261 +	return self;
  1.7262 +	}
  1.7263 +
  1.7264 +void RA3FDevSoundTonePlayToneOnceInitializedToPlayAudioTest::DoKickoffTestL()
  1.7265 +	{
  1.7266 +	if (!GetIntFromConfig(iTestStepName, KDuration, iDuration))
  1.7267 +		{
  1.7268 +		ERR_PRINTF2(KMsgErrorGetParameter, &KDuration);
  1.7269 +		StopTest(KErrNotFound);
  1.7270 +		return;
  1.7271 +		}
  1.7272 +	if (!GetIntFromConfig(iTestStepName, KFrequencyTone1, iFrequencyTone1))
  1.7273 +		{
  1.7274 +		ERR_PRINTF2(KMsgErrorGetParameter, &KFrequencyTone1);
  1.7275 +		StopTest(KErrNotFound);
  1.7276 +		return;
  1.7277 +		}
  1.7278 +	}
  1.7279 +
  1.7280 +void RA3FDevSoundTonePlayToneOnceInitializedToPlayAudioTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError)
  1.7281 +	{
  1.7282 +	switch (iDevSoundState)
  1.7283 +		{
  1.7284 +		case EStateCreated:
  1.7285 +			{
  1.7286 +			__ASSERT_ALWAYS((aError == KErrNone), Panic(_L("RA3FDevSoundTonePlayToneOnceInitializedToPlayAudioTest"), EFsmIncorrectErrorPassed));
  1.7287 +			if (aDevSoundEvent == EEventInitialize)
  1.7288 +				{
  1.7289 +				INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL for playing audio files"));
  1.7290 +				TRAPD(err, iMMFDevSound->InitializeL(*this, EMMFStatePlaying));
  1.7291 +				if (err != KErrNone)
  1.7292 +					{
  1.7293 +					ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err);
  1.7294 +					StopTest(err);
  1.7295 +					break;
  1.7296 +					}
  1.7297 +				INFO_PRINTF1(_L("DevSound State: EStateInitializing"));
  1.7298 +				iDevSoundState = EStateInitializing;
  1.7299 +				}
  1.7300 +			else
  1.7301 +				{
  1.7302 +				ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent);
  1.7303 +				StopTest(aError,  EFail);
  1.7304 +				}
  1.7305 +			break;
  1.7306 +			}
  1.7307 +		case EStateInitializing:
  1.7308 +			{
  1.7309 +			if (aDevSoundEvent == EEventInitComplete && aError == KErrNone)
  1.7310 +				{
  1.7311 +				INFO_PRINTF3(_L("Calling CMMFDevSound::PlayToneL using %d Hz during %d secs"), iFrequencyTone1, iDuration);
  1.7312 +				TRAPD(err, iMMFDevSound->PlayToneL(iFrequencyTone1, iDuration*KMicroSecsInOneSec));
  1.7313 +				if (err	== KErrNotSupported)
  1.7314 +					{
  1.7315 +					ERR_PRINTF2(_L("CMMFDevSound::PlayToneL left with KErrNotSupported %d which is the expected error"), err);
  1.7316 +					StopTest();
  1.7317 +					}
  1.7318 +				else
  1.7319 +					{
  1.7320 +					ERR_PRINTF2(_L("CMMFDevSound::PlayToneL left with error = %d"), err);
  1.7321 +					ERR_PRINTF2(_L("Expected error = %d"), KErrNotSupported);
  1.7322 +					StopTest(err, EFail);
  1.7323 +					}
  1.7324 +				}
  1.7325 +			else if (aDevSoundEvent == EEventInitComplete && aError != KErrNone)
  1.7326 +				{
  1.7327 +				ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error = %d"), aError);
  1.7328 +				StopTest(aError);
  1.7329 +				}
  1.7330 +			else
  1.7331 +				{
  1.7332 +				ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent);
  1.7333 +				StopTest(aError, EFail);
  1.7334 +				}
  1.7335 +			break;
  1.7336 +			}
  1.7337 +		default:
  1.7338 +			{
  1.7339 +			ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState);
  1.7340 +			StopTest(aError, EFail);
  1.7341 +			}
  1.7342 +		}
  1.7343 +	}
  1.7344 +
  1.7345 +/*
  1.7346 + *========================================================================================================
  1.7347 + * MM-A3F-DEVSOUND-CHRTZ-TONE-0052
  1.7348 + */
  1.7349 +RA3FDevSoundTonePlayDualToneOnceInitializedToPlayAudioTest::RA3FDevSoundTonePlayDualToneOnceInitializedToPlayAudioTest(const TDesC& aTestName)
  1.7350 +	:	RA3FDevSoundTestBase(aTestName), iDuration(0),
  1.7351 +		iFrequencyTone1(0), iFrequencyTone2(0)
  1.7352 +	{
  1.7353 +	}
  1.7354 +
  1.7355 +RA3FDevSoundTonePlayDualToneOnceInitializedToPlayAudioTest* RA3FDevSoundTonePlayDualToneOnceInitializedToPlayAudioTest::NewL(const TDesC& aTestName)
  1.7356 +	{
  1.7357 +	RA3FDevSoundTonePlayDualToneOnceInitializedToPlayAudioTest * self = new(ELeave)RA3FDevSoundTonePlayDualToneOnceInitializedToPlayAudioTest(aTestName);
  1.7358 +	return self;
  1.7359 +	}
  1.7360 +
  1.7361 +void RA3FDevSoundTonePlayDualToneOnceInitializedToPlayAudioTest::DoKickoffTestL()
  1.7362 +	{
  1.7363 +	if (!GetIntFromConfig(iTestStepName, KDuration, iDuration))
  1.7364 +		{
  1.7365 +		ERR_PRINTF2(KMsgErrorGetParameter, &KDuration);
  1.7366 +		StopTest(KErrNotFound);
  1.7367 +		return;
  1.7368 +		}
  1.7369 +	if (!GetIntFromConfig(iTestStepName, KFrequencyTone1, iFrequencyTone1))
  1.7370 +		{
  1.7371 +		ERR_PRINTF2(KMsgErrorGetParameter, &KFrequencyTone1);
  1.7372 +		StopTest(KErrNotFound);
  1.7373 +		return;
  1.7374 +		}
  1.7375 +	if (!GetIntFromConfig(iTestStepName, KFrequencyTone2, iFrequencyTone2))
  1.7376 +		{
  1.7377 +		ERR_PRINTF2(KMsgErrorGetParameter, &KFrequencyTone2);
  1.7378 +		StopTest(KErrNotFound);
  1.7379 +		return;
  1.7380 +		}
  1.7381 +	}
  1.7382 +
  1.7383 +void RA3FDevSoundTonePlayDualToneOnceInitializedToPlayAudioTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError)
  1.7384 +	{
  1.7385 +	switch(iDevSoundState)
  1.7386 +		{
  1.7387 +		case EStateCreated:
  1.7388 +			{
  1.7389 +			__ASSERT_ALWAYS((aError == KErrNone), Panic(_L("RA3FDevSoundTonePlayDualToneOnceInitializedToPlayAudioTest"), EFsmIncorrectErrorPassed));
  1.7390 +			if (aDevSoundEvent == EEventInitialize)
  1.7391 +				{
  1.7392 +				INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL for playing audio files"));
  1.7393 +				TRAPD(err, iMMFDevSound->InitializeL(*this, EMMFStatePlaying));
  1.7394 +				if (err != KErrNone)
  1.7395 +					{
  1.7396 +					ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err);
  1.7397 +					StopTest(err);
  1.7398 +					break;
  1.7399 +					}
  1.7400 +				INFO_PRINTF1(_L("DevSound State: EStateInitializing"));
  1.7401 +				iDevSoundState = EStateInitializing;
  1.7402 +				}
  1.7403 +			else
  1.7404 +				{
  1.7405 +				ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent);
  1.7406 +				StopTest(aError, EFail);
  1.7407 +				}
  1.7408 +			break;
  1.7409 +			}
  1.7410 +		case EStateInitializing:
  1.7411 +			{
  1.7412 +			if (aDevSoundEvent == EEventInitComplete && aError == KErrNone)
  1.7413 +				{
  1.7414 +				INFO_PRINTF4(_L("Calling CMMFDevSound::PlayDualToneL using %d Hz %d Hz during %d secs "), iFrequencyTone1, iFrequencyTone2, iDuration);
  1.7415 +				TRAPD(err, iMMFDevSound->PlayDualToneL(iFrequencyTone1, iFrequencyTone2, iDuration*KMicroSecsInOneSec));
  1.7416 +				if (err	== KErrNotSupported)
  1.7417 +					{
  1.7418 +					ERR_PRINTF2(_L("CMMFDevSound::PlayDualToneL left with KErrNotSupported %d which is the expected error"), err);
  1.7419 +					StopTest(err, EPass);
  1.7420 +					}
  1.7421 +				else
  1.7422 +					{
  1.7423 +					ERR_PRINTF2(_L("CMMFDevSound::PlayDualToneL left with error = %d"), err);
  1.7424 +					ERR_PRINTF2(_L("Expected error = %d"), KErrNotSupported);
  1.7425 +					StopTest(err, EFail);
  1.7426 +					}
  1.7427 +				}
  1.7428 +			else if (aDevSoundEvent == EEventInitComplete && aError != KErrNone)
  1.7429 +				{
  1.7430 +				ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error = %d"), aError);
  1.7431 +				StopTest(aError);
  1.7432 +				}
  1.7433 +			else
  1.7434 +				{
  1.7435 +				ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent);
  1.7436 +				StopTest(aError, EFail);
  1.7437 +				}
  1.7438 +			break;
  1.7439 +			}
  1.7440 +		default:
  1.7441 +			{
  1.7442 +			ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState);
  1.7443 +			StopTest(aError, EFail);
  1.7444 +			}
  1.7445 +		}
  1.7446 +	}
  1.7447 +
  1.7448 +/*
  1.7449 + *========================================================================================================
  1.7450 + * MM-A3F-DEVSOUND-CHRTZ-TONE-0053
  1.7451 + */
  1.7452 +RA3FDevSoundTonePlayDTMFStringOnceInitializedToPlayAudioTest::RA3FDevSoundTonePlayDTMFStringOnceInitializedToPlayAudioTest(const TDesC& aTestName)
  1.7453 +	:	RA3FDevSoundTestBase(aTestName), iDTMFString(KNullDesC)
  1.7454 +	{
  1.7455 +	}
  1.7456 +
  1.7457 +RA3FDevSoundTonePlayDTMFStringOnceInitializedToPlayAudioTest* RA3FDevSoundTonePlayDTMFStringOnceInitializedToPlayAudioTest::NewL(const TDesC& aTestName)
  1.7458 +	{
  1.7459 +	RA3FDevSoundTonePlayDTMFStringOnceInitializedToPlayAudioTest * self = new(ELeave)RA3FDevSoundTonePlayDTMFStringOnceInitializedToPlayAudioTest(aTestName);
  1.7460 +	return self;
  1.7461 +	}
  1.7462 +
  1.7463 +void RA3FDevSoundTonePlayDTMFStringOnceInitializedToPlayAudioTest::DoKickoffTestL()
  1.7464 +	{
  1.7465 +	TPtrC DTMF;
  1.7466 +	if (!GetStringFromConfig(iTestStepName, KDTMFString, DTMF))
  1.7467 +		{
  1.7468 +		ERR_PRINTF2(KMsgErrorGetParameter, &KDTMFString);
  1.7469 +		StopTest(KErrNotFound);
  1.7470 +		return;
  1.7471 +		}
  1.7472 +	iDTMFString.Copy(DTMF);
  1.7473 +	}
  1.7474 +
  1.7475 +void RA3FDevSoundTonePlayDTMFStringOnceInitializedToPlayAudioTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError)
  1.7476 +	{
  1.7477 +	switch(iDevSoundState)
  1.7478 +	{
  1.7479 +		case EStateCreated:
  1.7480 +			{
  1.7481 +			__ASSERT_ALWAYS((aError == KErrNone), Panic(_L("RA3FDevSoundTonePlayDTMFStringOnceInitializedToPlayAudioTest"), EFsmIncorrectErrorPassed));
  1.7482 +			if (aDevSoundEvent == EEventInitialize)
  1.7483 +				{
  1.7484 +				INFO_PRINTF1(_L("Calling iMMFDevSound::InitializeL for playing audio files"));
  1.7485 +				TRAPD(err, iMMFDevSound->InitializeL(*this, EMMFStatePlaying));
  1.7486 +				if (err != KErrNone)
  1.7487 +					{
  1.7488 +					ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err);
  1.7489 +					StopTest(err);
  1.7490 +					break;
  1.7491 +					}
  1.7492 +				INFO_PRINTF1(_L("DevSound State: EStateInitializing"));
  1.7493 +				iDevSoundState = EStateInitializing;
  1.7494 +				}
  1.7495 +			else
  1.7496 +				{
  1.7497 +				ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent);
  1.7498 +				StopTest(aError, EFail);
  1.7499 +				}
  1.7500 +			break;
  1.7501 +			}
  1.7502 +		case EStateInitializing:
  1.7503 +			{
  1.7504 +			if (aDevSoundEvent == EEventInitComplete && aError == KErrNone)
  1.7505 +				{
  1.7506 +				INFO_PRINTF2(_L("Calling CMMFDevSound::PlayDTMFStringL %S "), &iDTMFString);
  1.7507 +				TRAPD(err, iMMFDevSound->PlayDTMFStringL(iDTMFString));
  1.7508 +				if (err	== KErrNotSupported)
  1.7509 +					{
  1.7510 +					ERR_PRINTF2(_L("CMMFDevSound::PlayDTMFStringL left with KErrNotSupported %d which is the expected error"), err);
  1.7511 +					StopTest();
  1.7512 +					}
  1.7513 +				else
  1.7514 +					{
  1.7515 +					ERR_PRINTF2(_L("CMMFDevSound::PlayDTMFStringL left with error = %d"), err);
  1.7516 +					ERR_PRINTF2(_L("Expected error = %d"), KErrNotSupported);
  1.7517 +					StopTest(err, EFail);
  1.7518 +					}
  1.7519 +				}
  1.7520 +			else if (aDevSoundEvent == EEventInitComplete && aError != KErrNone)
  1.7521 +				{
  1.7522 +				ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error = %d"), aError);
  1.7523 +				StopTest(aError);
  1.7524 +				}
  1.7525 +			else
  1.7526 +				{
  1.7527 +				ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent);
  1.7528 +				StopTest(aError, EFail);
  1.7529 +				}
  1.7530 +			break;
  1.7531 +			}
  1.7532 +		default:
  1.7533 +			{
  1.7534 +			ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState);
  1.7535 +			StopTest(aError, EFail);
  1.7536 +			}
  1.7537 +		}
  1.7538 +	}
  1.7539 +
  1.7540 +/*
  1.7541 + *========================================================================================================
  1.7542 + * MM-A3F-DEVSOUND-CHRTZ-TONE-0054
  1.7543 + */
  1.7544 +RA3FDevSoundTonePlayToneSequenceOnceInitializedToPlayAudioTest::RA3FDevSoundTonePlayToneSequenceOnceInitializedToPlayAudioTest(const TDesC& aTestName)
  1.7545 +	:	RA3FDevSoundTestBase(aTestName)
  1.7546 +	{
  1.7547 +	}
  1.7548 +
  1.7549 +RA3FDevSoundTonePlayToneSequenceOnceInitializedToPlayAudioTest* RA3FDevSoundTonePlayToneSequenceOnceInitializedToPlayAudioTest::NewL(const TDesC& aTestName)
  1.7550 +	{
  1.7551 +	RA3FDevSoundTonePlayToneSequenceOnceInitializedToPlayAudioTest * self = new(ELeave)RA3FDevSoundTonePlayToneSequenceOnceInitializedToPlayAudioTest(aTestName);
  1.7552 +	return self;
  1.7553 +	}
  1.7554 +void RA3FDevSoundTonePlayToneSequenceOnceInitializedToPlayAudioTest::DoKickoffTestL()
  1.7555 +	{
  1.7556 +	}
  1.7557 +
  1.7558 +void RA3FDevSoundTonePlayToneSequenceOnceInitializedToPlayAudioTest::Fsm(TMmfDevSoundEvent aDevSoundEvent,  TInt aError)
  1.7559 +	{
  1.7560 +	switch(iDevSoundState)
  1.7561 +		{
  1.7562 +		case EStateCreated:
  1.7563 +			{
  1.7564 +			__ASSERT_ALWAYS((aError == KErrNone), Panic(_L("RA3FDevSoundTonePlayToneSequenceOnceInitializedToPlayAudioTest"), EFsmIncorrectErrorPassed));
  1.7565 +			if (aDevSoundEvent == EEventInitialize)
  1.7566 +				{
  1.7567 +				INFO_PRINTF1(_L("Calling iMMFDevSound::InitializeL for playing audio files"));
  1.7568 +				TRAPD(err, iMMFDevSound->InitializeL(*this,  EMMFStatePlaying));
  1.7569 +				if (err != KErrNone)
  1.7570 +					{
  1.7571 +					ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err);
  1.7572 +					StopTest(err);
  1.7573 +					break;
  1.7574 +					}
  1.7575 +				INFO_PRINTF1(_L("DevSound State: EStateInitializing"));
  1.7576 +				iDevSoundState = EStateInitializing;
  1.7577 +				}
  1.7578 +			else
  1.7579 +				{
  1.7580 +				ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent);
  1.7581 +				StopTest(aError, EFail);
  1.7582 +				}
  1.7583 +			break;
  1.7584 +			}
  1.7585 +		case EStateInitializing:
  1.7586 +			{
  1.7587 +			if (aDevSoundEvent == EEventInitComplete && aError == KErrNone)
  1.7588 +				{
  1.7589 +				TUint8* tablePointer = const_cast<TUint8*>( &(KFixedSequenceTestSequenceDataX[0] ) );
  1.7590 +				TPtrC8 KFixedSequenceData(tablePointer,  sizeof(KFixedSequenceTestSequenceDataX));
  1.7591 +				INFO_PRINTF1(_L("Calling CMMFDevSound::PlayToneSequenceL"));
  1.7592 +				TRAPD(err,  iMMFDevSound->PlayToneSequenceL(KFixedSequenceData));
  1.7593 +				if (err == KErrNotSupported)
  1.7594 +					{
  1.7595 +					ERR_PRINTF2(_L("CMMFDevSound::PlayToneSequenceL left with KErrNotSupported %d which is the expected error"), err);
  1.7596 +					StopTest(err, EPass);
  1.7597 +					}
  1.7598 +				else
  1.7599 +					{
  1.7600 +					ERR_PRINTF2(_L("Play  dual tone failed with error = %d"),  err);
  1.7601 +					ERR_PRINTF2(_L("Expected error = %d"), KErrNotSupported);
  1.7602 +					StopTest(err, EFail);
  1.7603 +					}
  1.7604 +				}
  1.7605 +			else if (aDevSoundEvent == EEventInitComplete && aError != KErrNone)
  1.7606 +				{
  1.7607 +				ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error = %d"), aError);
  1.7608 +				StopTest(aError);
  1.7609 +				}
  1.7610 +			else
  1.7611 +				{
  1.7612 +				ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent);
  1.7613 +				StopTest(aError, EFail);
  1.7614 +				}
  1.7615 +			break;
  1.7616 +			}
  1.7617 +		default:
  1.7618 +			{
  1.7619 +			ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState);
  1.7620 +			StopTest(aError, EFail);
  1.7621 +			}
  1.7622 +		}
  1.7623 +	}
  1.7624 +
  1.7625 +/*
  1.7626 + *========================================================================================================
  1.7627 + * MM-A3F-DEVSOUND-CHRTZ-TONE-0055
  1.7628 + */
  1.7629 +RA3FDevSoundTonePlayToneOnceInitializedToRecordAudioTest::RA3FDevSoundTonePlayToneOnceInitializedToRecordAudioTest(const TDesC& aTestName)
  1.7630 +	:	RA3FDevSoundTestBase(aTestName), iDuration(0),
  1.7631 +		iFrequencyTone1(0)
  1.7632 +	{
  1.7633 +	}
  1.7634 +
  1.7635 +RA3FDevSoundTonePlayToneOnceInitializedToRecordAudioTest* RA3FDevSoundTonePlayToneOnceInitializedToRecordAudioTest::NewL(const TDesC& aTestName)
  1.7636 +	{
  1.7637 +	RA3FDevSoundTonePlayToneOnceInitializedToRecordAudioTest * self = new(ELeave)RA3FDevSoundTonePlayToneOnceInitializedToRecordAudioTest(aTestName);
  1.7638 +	return self;
  1.7639 +	}
  1.7640 +
  1.7641 +void RA3FDevSoundTonePlayToneOnceInitializedToRecordAudioTest::DoKickoffTestL()
  1.7642 +	{
  1.7643 +	if (!GetIntFromConfig(iTestStepName, KDuration, iDuration))
  1.7644 +		{
  1.7645 +		ERR_PRINTF2(KMsgErrorGetParameter, &KDuration);
  1.7646 +		StopTest(KErrNotFound);
  1.7647 +		return;
  1.7648 +		}
  1.7649 +	if (!GetIntFromConfig(iTestStepName, KFrequencyTone1, iFrequencyTone1))
  1.7650 +		{
  1.7651 +		ERR_PRINTF2(KMsgErrorGetParameter, &KFrequencyTone1);
  1.7652 +		StopTest(KErrNotFound);
  1.7653 +		return;
  1.7654 +		}
  1.7655 +	}
  1.7656 +
  1.7657 +void RA3FDevSoundTonePlayToneOnceInitializedToRecordAudioTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError)
  1.7658 +	{
  1.7659 +	switch (iDevSoundState)
  1.7660 +		{
  1.7661 +		case EStateCreated:
  1.7662 +			{
  1.7663 +			__ASSERT_ALWAYS((aError == KErrNone), Panic(_L("RA3FDevSoundTonePlayToneOnceInitializedToRecordAudioTest"), EFsmIncorrectErrorPassed));
  1.7664 +			if (aDevSoundEvent == EEventInitialize)
  1.7665 +				{
  1.7666 +				INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL for recording audio files"));
  1.7667 +				TRAPD(err, iMMFDevSound->InitializeL(*this, EMMFStateRecording));
  1.7668 +				if (err != KErrNone)
  1.7669 +					{
  1.7670 +					ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err);
  1.7671 +					StopTest(err);
  1.7672 +					break;
  1.7673 +					}
  1.7674 +				INFO_PRINTF1(_L("DevSound State: EStateInitializing"));
  1.7675 +				iDevSoundState = EStateInitializing;
  1.7676 +				}
  1.7677 +			else
  1.7678 +				{
  1.7679 +				ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent);
  1.7680 +				StopTest(aError,  EFail);
  1.7681 +				}
  1.7682 +			break;
  1.7683 +			}
  1.7684 +		case EStateInitializing:
  1.7685 +			{
  1.7686 +			if (aDevSoundEvent == EEventInitComplete && aError == KErrNone)
  1.7687 +				{
  1.7688 +				INFO_PRINTF3(_L("Calling CMMFDevSound::PlayToneL using %d Hz during %d secs"), iFrequencyTone1, iDuration);
  1.7689 +				TRAPD(err, iMMFDevSound->PlayToneL(iFrequencyTone1, iDuration*KMicroSecsInOneSec));
  1.7690 +				if (err	== KErrNotSupported)
  1.7691 +					{
  1.7692 +					ERR_PRINTF2(_L("CMMFDevSound::PlayToneL left with KErrNotSupported %d which is the expected error"), err);
  1.7693 +					StopTest();
  1.7694 +					}
  1.7695 +				else
  1.7696 +					{
  1.7697 +					ERR_PRINTF2(_L("CMMFDevSound::PlayToneL left with error = %d"), err);
  1.7698 +					ERR_PRINTF2(_L("Expected error = %d"), KErrNotSupported);
  1.7699 +					StopTest(err, EFail);
  1.7700 +					}
  1.7701 +				}
  1.7702 +			else if (aDevSoundEvent == EEventInitComplete && aError != KErrNone)
  1.7703 +				{
  1.7704 +				ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error = %d"), aError);
  1.7705 +				StopTest(aError);
  1.7706 +				}
  1.7707 +			else
  1.7708 +				{
  1.7709 +				ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent);
  1.7710 +				StopTest(aError, EFail);
  1.7711 +				}
  1.7712 +			break;
  1.7713 +			}
  1.7714 +		default:
  1.7715 +			{
  1.7716 +			ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState);
  1.7717 +			StopTest(aError, EFail);
  1.7718 +			}
  1.7719 +		}
  1.7720 +	}
  1.7721 +
  1.7722 +/*
  1.7723 + *========================================================================================================
  1.7724 + * MM-A3F-DEVSOUND-CHRTZ-TONE-0056
  1.7725 + */
  1.7726 +RA3FDevSoundTonePlayDualToneOnceInitializedToRecordAudioTest::RA3FDevSoundTonePlayDualToneOnceInitializedToRecordAudioTest(const TDesC& aTestName)
  1.7727 +	:	RA3FDevSoundTestBase(aTestName), iDuration(0),
  1.7728 +		iFrequencyTone1(0), iFrequencyTone2(0)
  1.7729 +	{
  1.7730 +	}
  1.7731 +
  1.7732 +RA3FDevSoundTonePlayDualToneOnceInitializedToRecordAudioTest* RA3FDevSoundTonePlayDualToneOnceInitializedToRecordAudioTest::NewL(const TDesC& aTestName)
  1.7733 +	{
  1.7734 +	RA3FDevSoundTonePlayDualToneOnceInitializedToRecordAudioTest * self = new(ELeave)RA3FDevSoundTonePlayDualToneOnceInitializedToRecordAudioTest(aTestName);
  1.7735 +	return self;
  1.7736 +	}
  1.7737 +
  1.7738 +void RA3FDevSoundTonePlayDualToneOnceInitializedToRecordAudioTest::DoKickoffTestL()
  1.7739 +	{
  1.7740 +	if (!GetIntFromConfig(iTestStepName, KDuration, iDuration))
  1.7741 +		{
  1.7742 +		ERR_PRINTF2(KMsgErrorGetParameter, &KDuration);
  1.7743 +		StopTest(KErrNotFound);
  1.7744 +		return;
  1.7745 +		}
  1.7746 +	if (!GetIntFromConfig(iTestStepName, KFrequencyTone1, iFrequencyTone1))
  1.7747 +		{
  1.7748 +		ERR_PRINTF2(KMsgErrorGetParameter, &KFrequencyTone1);
  1.7749 +		StopTest(KErrNotFound);
  1.7750 +		return;
  1.7751 +		}
  1.7752 +	if (!GetIntFromConfig(iTestStepName, KFrequencyTone2, iFrequencyTone2))
  1.7753 +		{
  1.7754 +		ERR_PRINTF2(KMsgErrorGetParameter, &KFrequencyTone2);
  1.7755 +		StopTest(KErrNotFound);
  1.7756 +		return;
  1.7757 +		}
  1.7758 +	}
  1.7759 +
  1.7760 +void RA3FDevSoundTonePlayDualToneOnceInitializedToRecordAudioTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError)
  1.7761 +	{
  1.7762 +	switch(iDevSoundState)
  1.7763 +		{
  1.7764 +		case EStateCreated:
  1.7765 +			{
  1.7766 +			__ASSERT_ALWAYS((aError == KErrNone), Panic(_L("RA3FDevSoundTonePlayDualToneOnceInitializedToRecordAudioTest"), EFsmIncorrectErrorPassed));
  1.7767 +			if (aDevSoundEvent == EEventInitialize)
  1.7768 +				{
  1.7769 +				INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL for recording audio files"));
  1.7770 +				TRAPD(err, iMMFDevSound->InitializeL(*this, EMMFStateRecording));
  1.7771 +				if (err != KErrNone)
  1.7772 +					{
  1.7773 +					ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err);
  1.7774 +					StopTest(err);
  1.7775 +					break;
  1.7776 +					}
  1.7777 +				INFO_PRINTF1(_L("DevSound State: EStateInitializing"));
  1.7778 +				iDevSoundState = EStateInitializing;
  1.7779 +				}
  1.7780 +			else
  1.7781 +				{
  1.7782 +				ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent);
  1.7783 +				StopTest(aError, EFail);
  1.7784 +				}
  1.7785 +			break;
  1.7786 +			}
  1.7787 +		case EStateInitializing:
  1.7788 +			{
  1.7789 +			if (aDevSoundEvent == EEventInitComplete && aError == KErrNone)
  1.7790 +				{
  1.7791 +				INFO_PRINTF4(_L("Calling CMMFDevSound::PlayDualToneL using %d Hz %d Hz during %d secs "), iFrequencyTone1, iFrequencyTone2, iDuration);
  1.7792 +				TRAPD(err, iMMFDevSound->PlayDualToneL(iFrequencyTone1, iFrequencyTone2, iDuration*KMicroSecsInOneSec));
  1.7793 +				if (err	== KErrNotSupported)
  1.7794 +					{
  1.7795 +					ERR_PRINTF2(_L("CMMFDevSound::PlayDualToneL left with KErrNotSupported %d which is the expected error"), err);
  1.7796 +					StopTest(err, EPass);
  1.7797 +					}
  1.7798 +				else
  1.7799 +					{
  1.7800 +					ERR_PRINTF2(_L("CMMFDevSound::PlayDualToneL left with error = %d"), err);
  1.7801 +					ERR_PRINTF2(_L("Expected error = %d"), KErrNotSupported);
  1.7802 +					StopTest(err, EFail);
  1.7803 +					}
  1.7804 +				}
  1.7805 +			else if (aDevSoundEvent == EEventInitComplete && aError != KErrNone)
  1.7806 +				{
  1.7807 +				ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error = %d"), aError);
  1.7808 +				StopTest(aError);
  1.7809 +				}
  1.7810 +			else
  1.7811 +				{
  1.7812 +				ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent);
  1.7813 +				StopTest(aError, EFail);
  1.7814 +				}
  1.7815 +			break;
  1.7816 +			}
  1.7817 +		default:
  1.7818 +			{
  1.7819 +			ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState);
  1.7820 +			StopTest(aError, EFail);
  1.7821 +			}
  1.7822 +		}
  1.7823 +	}
  1.7824 +
  1.7825 +/*
  1.7826 + *========================================================================================================
  1.7827 + * MM-A3F-DEVSOUND-CHRTZ-TONE-0057
  1.7828 + */
  1.7829 +RA3FDevSoundTonePlayDTMFStringOnceInitializedToRecordAudioTest::RA3FDevSoundTonePlayDTMFStringOnceInitializedToRecordAudioTest(const TDesC& aTestName)
  1.7830 +	:	RA3FDevSoundTestBase(aTestName), iDTMFString(KNullDesC)
  1.7831 +	{
  1.7832 +	}
  1.7833 +
  1.7834 +RA3FDevSoundTonePlayDTMFStringOnceInitializedToRecordAudioTest* RA3FDevSoundTonePlayDTMFStringOnceInitializedToRecordAudioTest::NewL(const TDesC& aTestName)
  1.7835 +	{
  1.7836 +	RA3FDevSoundTonePlayDTMFStringOnceInitializedToRecordAudioTest * self = new(ELeave)RA3FDevSoundTonePlayDTMFStringOnceInitializedToRecordAudioTest(aTestName);
  1.7837 +	return self;
  1.7838 +	}
  1.7839 +
  1.7840 +void RA3FDevSoundTonePlayDTMFStringOnceInitializedToRecordAudioTest::DoKickoffTestL()
  1.7841 +	{
  1.7842 +	TPtrC DTMF;
  1.7843 +	if (!GetStringFromConfig(iTestStepName, KDTMFString, DTMF))
  1.7844 +		{
  1.7845 +		ERR_PRINTF2(KMsgErrorGetParameter, &KDTMFString);
  1.7846 +		StopTest(KErrNotFound);
  1.7847 +		return;
  1.7848 +		}
  1.7849 +	iDTMFString.Copy(DTMF);
  1.7850 +	}
  1.7851 +
  1.7852 +void RA3FDevSoundTonePlayDTMFStringOnceInitializedToRecordAudioTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError)
  1.7853 +	{
  1.7854 +	switch(iDevSoundState)
  1.7855 +	{
  1.7856 +		case EStateCreated:
  1.7857 +			{
  1.7858 +			__ASSERT_ALWAYS((aError == KErrNone), Panic(_L("RA3FDevSoundTonePlayDTMFStringOnceInitializedToRecordAudioTest"), EFsmIncorrectErrorPassed));
  1.7859 +			if (aDevSoundEvent == EEventInitialize)
  1.7860 +				{
  1.7861 +				INFO_PRINTF1(_L("Calling iMMFDevSound::InitializeL for recording audio files"));
  1.7862 +				TRAPD(err, iMMFDevSound->InitializeL(*this, EMMFStateRecording));
  1.7863 +				if (err != KErrNone)
  1.7864 +					{
  1.7865 +					ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err);
  1.7866 +					StopTest(err);
  1.7867 +					break;
  1.7868 +					}
  1.7869 +				INFO_PRINTF1(_L("DevSound State: EStateInitializing"));
  1.7870 +				iDevSoundState = EStateInitializing;
  1.7871 +				}
  1.7872 +			else
  1.7873 +				{
  1.7874 +				ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent);
  1.7875 +				StopTest(aError, EFail);
  1.7876 +				}
  1.7877 +			break;
  1.7878 +			}
  1.7879 +		case EStateInitializing:
  1.7880 +			{
  1.7881 +			if (aDevSoundEvent == EEventInitComplete && aError == KErrNone)
  1.7882 +				{
  1.7883 +				INFO_PRINTF2(_L("Calling CMMFDevSound::PlayDTMFStringL %S "), &iDTMFString);
  1.7884 +				TRAPD(err, iMMFDevSound->PlayDTMFStringL(iDTMFString));
  1.7885 +				if (err	== KErrNotSupported)
  1.7886 +					{
  1.7887 +					ERR_PRINTF2(_L("CMMFDevSound::PlayDTMFStringL left with KErrNotSupported %d which is the expected error"), err);
  1.7888 +					StopTest();
  1.7889 +					}
  1.7890 +				else
  1.7891 +					{
  1.7892 +					ERR_PRINTF2(_L("CMMFDevSound::PlayDTMFStringL left with error = %d"), err);
  1.7893 +					ERR_PRINTF2(_L("Expected error = %d"), KErrNotSupported);
  1.7894 +					StopTest(err, EFail);
  1.7895 +					}
  1.7896 +				}
  1.7897 +			else if (aDevSoundEvent == EEventInitComplete && aError != KErrNone)
  1.7898 +				{
  1.7899 +				ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error = %d"), aError);
  1.7900 +				StopTest(aError);
  1.7901 +				}
  1.7902 +			else
  1.7903 +				{
  1.7904 +				ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent);
  1.7905 +				StopTest(aError, EFail);
  1.7906 +				}
  1.7907 +			break;
  1.7908 +			}
  1.7909 +		default:
  1.7910 +			{
  1.7911 +			ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState);
  1.7912 +			StopTest(aError, EFail);
  1.7913 +			}
  1.7914 +		}
  1.7915 +	}
  1.7916 +
  1.7917 +/*
  1.7918 + *========================================================================================================
  1.7919 + * MM-A3F-DEVSOUND-CHRTZ-TONE-0058
  1.7920 + */
  1.7921 +RA3FDevSoundTonePlayToneSequenceOnceInitializedToRecordAudioTest::RA3FDevSoundTonePlayToneSequenceOnceInitializedToRecordAudioTest(const TDesC& aTestName)
  1.7922 +	:	RA3FDevSoundTestBase(aTestName)
  1.7923 +	{
  1.7924 +	}
  1.7925 +
  1.7926 +RA3FDevSoundTonePlayToneSequenceOnceInitializedToRecordAudioTest* RA3FDevSoundTonePlayToneSequenceOnceInitializedToRecordAudioTest::NewL(const TDesC& aTestName)
  1.7927 +	{
  1.7928 +	RA3FDevSoundTonePlayToneSequenceOnceInitializedToRecordAudioTest * self = new(ELeave)RA3FDevSoundTonePlayToneSequenceOnceInitializedToRecordAudioTest(aTestName);
  1.7929 +	return self;
  1.7930 +	}
  1.7931 +void RA3FDevSoundTonePlayToneSequenceOnceInitializedToRecordAudioTest::DoKickoffTestL()
  1.7932 +	{
  1.7933 +	}
  1.7934 +
  1.7935 +void RA3FDevSoundTonePlayToneSequenceOnceInitializedToRecordAudioTest::Fsm(TMmfDevSoundEvent aDevSoundEvent,  TInt aError)
  1.7936 +	{
  1.7937 +	switch(iDevSoundState)
  1.7938 +		{
  1.7939 +		case EStateCreated:
  1.7940 +			{
  1.7941 +			__ASSERT_ALWAYS((aError == KErrNone), Panic(_L("RA3FDevSoundTonePlayToneSequenceOnceInitializedToRecordAudioTest"), EFsmIncorrectErrorPassed));
  1.7942 +			if (aDevSoundEvent == EEventInitialize)
  1.7943 +				{
  1.7944 +				INFO_PRINTF1(_L("Calling iMMFDevSound::InitializeL for playing audio files"));
  1.7945 +				TRAPD(err, iMMFDevSound->InitializeL(*this,  EMMFStateRecording));
  1.7946 +				if (err != KErrNone)
  1.7947 +					{
  1.7948 +					ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err);
  1.7949 +					StopTest(err);
  1.7950 +					break;
  1.7951 +					}
  1.7952 +				INFO_PRINTF1(_L("DevSound State: EStateInitializing"));
  1.7953 +				iDevSoundState = EStateInitializing;
  1.7954 +				}
  1.7955 +			else
  1.7956 +				{
  1.7957 +				ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent);
  1.7958 +				StopTest(aError, EFail);
  1.7959 +				}
  1.7960 +			break;
  1.7961 +			}
  1.7962 +		case EStateInitializing:
  1.7963 +			{
  1.7964 +			if (aDevSoundEvent == EEventInitComplete && aError == KErrNone)
  1.7965 +				{
  1.7966 +				TUint8* tablePointer = const_cast<TUint8*>( &(KFixedSequenceTestSequenceDataX[0] ) );
  1.7967 +				TPtrC8 KFixedSequenceData(tablePointer,  sizeof(KFixedSequenceTestSequenceDataX));
  1.7968 +				INFO_PRINTF1(_L("Calling CMMFDevSound::PlayToneSequenceL"));
  1.7969 +				TRAPD(err,  iMMFDevSound->PlayToneSequenceL(KFixedSequenceData));
  1.7970 +				if (err == KErrNotSupported)
  1.7971 +					{
  1.7972 +					ERR_PRINTF2(_L("CMMFDevSound::PlayToneSequenceL left with KErrNotSupported %d which is the expected error"), err);
  1.7973 +					StopTest(err, EPass);
  1.7974 +					}
  1.7975 +				else
  1.7976 +					{
  1.7977 +					ERR_PRINTF2(_L("Play  dual tone failed with error = %d"),  err);
  1.7978 +					ERR_PRINTF2(_L("Expected error = %d"), KErrNotSupported);
  1.7979 +					StopTest(err, EFail);
  1.7980 +					}
  1.7981 +				}
  1.7982 +			else if (aDevSoundEvent == EEventInitComplete && aError != KErrNone)
  1.7983 +				{
  1.7984 +				ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error = %d"), aError);
  1.7985 +				StopTest(aError);
  1.7986 +				}
  1.7987 +			else
  1.7988 +				{
  1.7989 +				ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent);
  1.7990 +				StopTest(aError, EFail);
  1.7991 +				}
  1.7992 +			break;
  1.7993 +			}
  1.7994 +		default:
  1.7995 +			{
  1.7996 +			ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState);
  1.7997 +			StopTest(aError, EFail);
  1.7998 +			}
  1.7999 +		}
  1.8000 +	}
  1.8001 +
  1.8002 +/*
  1.8003 + *========================================================================================================
  1.8004 + * MM-A3F-DEVSOUND-CHRTZ-TONE-0059
  1.8005 + */
  1.8006 +RA3FDevSoundTonePlayToneWithoutCallingInitializeTest::RA3FDevSoundTonePlayToneWithoutCallingInitializeTest(const TDesC& aTestName)
  1.8007 +	:	RA3FDevSoundTestBase(aTestName), iDuration(0),
  1.8008 +		iFrequencyTone1(0)
  1.8009 +	{
  1.8010 +	}
  1.8011 +
  1.8012 +RA3FDevSoundTonePlayToneWithoutCallingInitializeTest* RA3FDevSoundTonePlayToneWithoutCallingInitializeTest::NewL(const TDesC& aTestName)
  1.8013 +	{
  1.8014 +	RA3FDevSoundTonePlayToneWithoutCallingInitializeTest * self = new(ELeave)RA3FDevSoundTonePlayToneWithoutCallingInitializeTest(aTestName);
  1.8015 +	return self;
  1.8016 +	}
  1.8017 +
  1.8018 +void RA3FDevSoundTonePlayToneWithoutCallingInitializeTest::DoKickoffTestL()
  1.8019 +	{
  1.8020 +	if (!GetIntFromConfig(iTestStepName, KDuration, iDuration))
  1.8021 +		{
  1.8022 +		ERR_PRINTF2(KMsgErrorGetParameter, &KDuration);
  1.8023 +		StopTest(KErrNotFound);
  1.8024 +		return;
  1.8025 +		}
  1.8026 +	if (!GetIntFromConfig(iTestStepName, KFrequencyTone1, iFrequencyTone1))
  1.8027 +		{
  1.8028 +		ERR_PRINTF2(KMsgErrorGetParameter, &KFrequencyTone1);
  1.8029 +		StopTest(KErrNotFound);
  1.8030 +		return;
  1.8031 +		}
  1.8032 +	}
  1.8033 +
  1.8034 +void RA3FDevSoundTonePlayToneWithoutCallingInitializeTest::Fsm(TMmfDevSoundEvent aDevSoundEvent,  TInt aError)
  1.8035 +	{
  1.8036 +	switch (iDevSoundState)
  1.8037 +		{
  1.8038 +		case EStateCreated:
  1.8039 +			{
  1.8040 +			__ASSERT_ALWAYS((aError == KErrNone), Panic(_L("RA3FDevSoundTonePlayToneWithoutCallingInitializeTest"), EFsmIncorrectErrorPassed));
  1.8041 +			if (aDevSoundEvent == EEventInitialize)
  1.8042 +				{
  1.8043 +				INFO_PRINTF3(_L("Calling CMMFDevSound::PlayToneL using %d Hz during %d secs"), iFrequencyTone1, iDuration);
  1.8044 +				TRAPD(err, iMMFDevSound->PlayToneL(iFrequencyTone1, iDuration*KMicroSecsInOneSec));
  1.8045 +				if (err	== KErrNotReady)
  1.8046 +					{
  1.8047 +					ERR_PRINTF2(_L("CMMFDevSound::PlayToneL left with KErrNotReady %d which is the expected error"), err);
  1.8048 +					StopTest();
  1.8049 +					}
  1.8050 +				else
  1.8051 +					{
  1.8052 +					ERR_PRINTF2(_L("CMMFDevSound::PlayToneL left with error = %d"), err);
  1.8053 +					ERR_PRINTF2(_L("Expected error = %d"), KErrNotReady);
  1.8054 +					StopTest(err, EFail);
  1.8055 +					}
  1.8056 +				}
  1.8057 +			else if (aDevSoundEvent == EEventInitComplete && aError != KErrNone)
  1.8058 +				{
  1.8059 +				ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error = %d"), aError);
  1.8060 +				StopTest(aError);
  1.8061 +				}
  1.8062 +			else
  1.8063 +				{
  1.8064 +				ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent);
  1.8065 +				StopTest(aError, EFail);
  1.8066 +				}
  1.8067 +			break;
  1.8068 +			}
  1.8069 +		default:
  1.8070 +			{
  1.8071 +			ERR_PRINTF2(_L("Invalid DevSound state received: %d"),  iDevSoundState);
  1.8072 +			StopTest(aError, EFail);
  1.8073 +			}
  1.8074 +		}
  1.8075 +	}
  1.8076 +
  1.8077 +/*
  1.8078 + *========================================================================================================
  1.8079 + * MM-A3F-DEVSOUND-CHRTZ-TONE-0060
  1.8080 + */
  1.8081 +RA3FDevSoundTonePlayDualToneWithoutCallingInitializeTest::RA3FDevSoundTonePlayDualToneWithoutCallingInitializeTest(const TDesC& aTestName)
  1.8082 +	:	RA3FDevSoundTestBase(aTestName), iDuration(0),
  1.8083 +		iFrequencyTone1(0), iFrequencyTone2(0)
  1.8084 +	{
  1.8085 +	}
  1.8086 +
  1.8087 +RA3FDevSoundTonePlayDualToneWithoutCallingInitializeTest* RA3FDevSoundTonePlayDualToneWithoutCallingInitializeTest::NewL(const TDesC& aTestName)
  1.8088 +	{
  1.8089 +	RA3FDevSoundTonePlayDualToneWithoutCallingInitializeTest * self = new(ELeave)RA3FDevSoundTonePlayDualToneWithoutCallingInitializeTest(aTestName);
  1.8090 +	return self;
  1.8091 +	}
  1.8092 +
  1.8093 +void RA3FDevSoundTonePlayDualToneWithoutCallingInitializeTest::DoKickoffTestL()
  1.8094 +	{
  1.8095 +	if (!GetIntFromConfig(iTestStepName, KDuration, iDuration))
  1.8096 +		{
  1.8097 +		ERR_PRINTF2(KMsgErrorGetParameter, &KDuration);
  1.8098 +		StopTest(KErrNotFound);
  1.8099 +		return;
  1.8100 +		}
  1.8101 +	if (!GetIntFromConfig(iTestStepName, KFrequencyTone1, iFrequencyTone1))
  1.8102 +		{
  1.8103 +		ERR_PRINTF2(KMsgErrorGetParameter, &KFrequencyTone1);
  1.8104 +		StopTest(KErrNotFound);
  1.8105 +		return;
  1.8106 +		}
  1.8107 +	if (!GetIntFromConfig(iTestStepName, KFrequencyTone2, iFrequencyTone2))
  1.8108 +		{
  1.8109 +		ERR_PRINTF2(KMsgErrorGetParameter, &KFrequencyTone2);
  1.8110 +		StopTest(KErrNotFound);
  1.8111 +		return;
  1.8112 +		}
  1.8113 +	}
  1.8114 +
  1.8115 +void RA3FDevSoundTonePlayDualToneWithoutCallingInitializeTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError)
  1.8116 +	{
  1.8117 +	switch (iDevSoundState)
  1.8118 +		{
  1.8119 +		case EStateCreated:
  1.8120 +			{
  1.8121 +			__ASSERT_ALWAYS((aError == KErrNone), Panic(_L("RA3FDevSoundTonePlayDualToneWithoutCallingInitializeTest"), EFsmIncorrectErrorPassed));
  1.8122 +			if (aDevSoundEvent == EEventInitialize)
  1.8123 +				{
  1.8124 +				INFO_PRINTF4(_L("Calling CMMFDevSound::PlayDualToneL using %d Hz %d Hz during %d secs "), iFrequencyTone1, iFrequencyTone2, iDuration);
  1.8125 +				TRAPD(err, iMMFDevSound->PlayDualToneL(iFrequencyTone1, iFrequencyTone2, iDuration*KMicroSecsInOneSec));
  1.8126 +				if (err == KErrNotReady)
  1.8127 +					{
  1.8128 +					ERR_PRINTF2(_L("CMMFDevSound::PlayDualToneL left with KErrNotReady %d which is the expected error"), err);
  1.8129 +					StopTest();
  1.8130 +					}
  1.8131 +				else
  1.8132 +					{
  1.8133 +					ERR_PRINTF2(_L("CMMFDevSound::PlayDualToneL left with error = %d"), err);
  1.8134 +					ERR_PRINTF2(_L("Expected error = %d"), KErrNotReady);
  1.8135 +					StopTest(err, EFail);
  1.8136 +					}
  1.8137 +				}
  1.8138 +			else if (aDevSoundEvent == EEventInitComplete && aError != KErrNone)
  1.8139 +				{
  1.8140 +				ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error = %d"), aError);
  1.8141 +				StopTest(aError);
  1.8142 +				}
  1.8143 +			else
  1.8144 +				{
  1.8145 +				ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent);
  1.8146 +				StopTest(aError, EFail);
  1.8147 +				}
  1.8148 +			break;
  1.8149 +			}
  1.8150 +		default:
  1.8151 +			{
  1.8152 +			ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState);
  1.8153 +			StopTest(aError, EFail);
  1.8154 +			}
  1.8155 +		}
  1.8156 +	}
  1.8157 +
  1.8158 +/*
  1.8159 + *========================================================================================================
  1.8160 + * MM-A3F-DEVSOUND-CHRTZ-TONE-0061
  1.8161 + */
  1.8162 +RA3FDevSoundTonePlayDTMFStringWithoutCallingInitializeTest::RA3FDevSoundTonePlayDTMFStringWithoutCallingInitializeTest(const TDesC& aTestName)
  1.8163 +	:	RA3FDevSoundTestBase(aTestName), iDTMFString(KNullDesC)
  1.8164 +	{
  1.8165 +	}
  1.8166 +
  1.8167 +RA3FDevSoundTonePlayDTMFStringWithoutCallingInitializeTest* RA3FDevSoundTonePlayDTMFStringWithoutCallingInitializeTest::NewL(const TDesC& aTestName)
  1.8168 +	{
  1.8169 +	RA3FDevSoundTonePlayDTMFStringWithoutCallingInitializeTest * self = new(ELeave)RA3FDevSoundTonePlayDTMFStringWithoutCallingInitializeTest(aTestName);
  1.8170 +	return self;
  1.8171 +	}
  1.8172 +
  1.8173 +void RA3FDevSoundTonePlayDTMFStringWithoutCallingInitializeTest::DoKickoffTestL()
  1.8174 +	{
  1.8175 +	TPtrC DTMF;
  1.8176 +	if (!GetStringFromConfig(iTestStepName, KDTMFString, DTMF))
  1.8177 +		{
  1.8178 +		ERR_PRINTF2(KMsgErrorGetParameter, &KDTMFString);
  1.8179 +		StopTest(KErrNotFound);
  1.8180 +		return;
  1.8181 +		}
  1.8182 +	iDTMFString.Copy(DTMF);
  1.8183 +	}
  1.8184 +
  1.8185 +void RA3FDevSoundTonePlayDTMFStringWithoutCallingInitializeTest::Fsm(TMmfDevSoundEvent aDevSoundEvent,  TInt aError)
  1.8186 +	{
  1.8187 +	switch (iDevSoundState)
  1.8188 +		{
  1.8189 +		case EStateCreated:
  1.8190 +			{
  1.8191 +			__ASSERT_ALWAYS((aError == KErrNone), Panic(_L("RA3FDevSoundTonePlayDTMFStringWithoutCallingInitializeTest"), EFsmIncorrectErrorPassed));
  1.8192 +			if (aDevSoundEvent == EEventInitialize)
  1.8193 +				{
  1.8194 +				INFO_PRINTF2(_L("Calling CMMFDevSound::PlayDTMFStringL %S"), &iDTMFString);
  1.8195 +				TRAPD(err, iMMFDevSound->PlayDTMFStringL(iDTMFString));
  1.8196 +				if (err == KErrNotReady)
  1.8197 +					{
  1.8198 +					ERR_PRINTF2(_L("CMMFDevSound::PlayDTMFStringL left with KErrNotReady %d which is the expected error"), err);
  1.8199 +					StopTest();
  1.8200 +					}
  1.8201 +				else
  1.8202 +					{
  1.8203 +					ERR_PRINTF2(_L("CMMFDevSound::PlayDTMFStringL left with error = %d"), err);
  1.8204 +					ERR_PRINTF2(_L("Expected error = %d"), KErrNotReady);
  1.8205 +					StopTest(err, EFail);
  1.8206 +					}
  1.8207 +				}
  1.8208 +			else if (aDevSoundEvent == EEventInitComplete && aError != KErrNone)
  1.8209 +				{
  1.8210 +				ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error = %d"), aError);
  1.8211 +				StopTest(aError);
  1.8212 +				}
  1.8213 +			else
  1.8214 +				{
  1.8215 +				ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent);
  1.8216 +				StopTest(aError, EFail);
  1.8217 +				}
  1.8218 +			break;
  1.8219 +			}
  1.8220 +		default:
  1.8221 +			{
  1.8222 +			ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState);
  1.8223 +			StopTest(aError, EFail);
  1.8224 +			}
  1.8225 +		}
  1.8226 +	}
  1.8227 +
  1.8228 +/*
  1.8229 + *========================================================================================================
  1.8230 + * MM-A3F-DEVSOUND-CHRTZ-TONE-0062
  1.8231 + */
  1.8232 +RA3FDevSoundTonePlayToneSequenceWithoutCallingInitializeTest::RA3FDevSoundTonePlayToneSequenceWithoutCallingInitializeTest(const TDesC& aTestName)
  1.8233 +	:	RA3FDevSoundTestBase(aTestName)
  1.8234 +	{
  1.8235 +	}
  1.8236 +
  1.8237 +RA3FDevSoundTonePlayToneSequenceWithoutCallingInitializeTest* RA3FDevSoundTonePlayToneSequenceWithoutCallingInitializeTest::NewL(const TDesC& aTestName)
  1.8238 +	{
  1.8239 +	RA3FDevSoundTonePlayToneSequenceWithoutCallingInitializeTest * self = new(ELeave)RA3FDevSoundTonePlayToneSequenceWithoutCallingInitializeTest(aTestName);
  1.8240 +	return self;
  1.8241 +	}
  1.8242 +
  1.8243 +void RA3FDevSoundTonePlayToneSequenceWithoutCallingInitializeTest::DoKickoffTestL()
  1.8244 +	{
  1.8245 +	}
  1.8246 +
  1.8247 +void RA3FDevSoundTonePlayToneSequenceWithoutCallingInitializeTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError)
  1.8248 +	{
  1.8249 +	switch (iDevSoundState)
  1.8250 +		{
  1.8251 +		case EStateCreated:
  1.8252 +			{
  1.8253 +			__ASSERT_ALWAYS((aError == KErrNone), Panic(_L("RA3FDevSoundTonePlayToneSequenceWithoutCallingInitializeTest"), EFsmIncorrectErrorPassed));
  1.8254 +			if (aDevSoundEvent == EEventInitialize)
  1.8255 +				{
  1.8256 +				TUint8* tablePointer = const_cast<TUint8*>( &(KFixedSequenceTestSequenceDataX[0] ) );
  1.8257 +				TPtrC8 KFixedSequenceData(tablePointer,  sizeof(KFixedSequenceTestSequenceDataX));
  1.8258 +				INFO_PRINTF1(_L("Calling CMMFDevSound::PlayToneSequenceL"));
  1.8259 +				TRAPD(err, iMMFDevSound->PlayToneSequenceL(KFixedSequenceData));
  1.8260 +				if (err == KErrNotReady)
  1.8261 +					{
  1.8262 +					ERR_PRINTF2(_L("CMMFDevSound::PlayToneSequenceL left with KErrNotReady %d which is the expected error"), err);
  1.8263 +					StopTest();
  1.8264 +					}
  1.8265 +				else
  1.8266 +					{
  1.8267 +					ERR_PRINTF2(_L("CMMFDevSound::PlayToneSequenceL left with error = %d"), err);
  1.8268 +					ERR_PRINTF2(_L("Expected error = %d"), KErrNotReady);
  1.8269 +					StopTest(err, EFail);
  1.8270 +					}
  1.8271 +				}
  1.8272 +			else if (aDevSoundEvent == EEventInitComplete && aError != KErrNone)
  1.8273 +				{
  1.8274 +				ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error = %d"), aError);
  1.8275 +				StopTest(aError);
  1.8276 +				}
  1.8277 +			else
  1.8278 +				{
  1.8279 +				ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent);
  1.8280 +				StopTest(aError, EFail);
  1.8281 +				}
  1.8282 +			break;
  1.8283 +			}
  1.8284 +		default:
  1.8285 +			{
  1.8286 +			ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState);
  1.8287 +			StopTest(aError, EFail);
  1.8288 +			}
  1.8289 +		}
  1.8290 +	}
  1.8291 +
  1.8292 +/*
  1.8293 + *========================================================================================================
  1.8294 + * MM-A3F-DEVSOUND-CHRTZ-TONE-0063
  1.8295 + */
  1.8296 +RA3FDevSoundTonePlayToneSequenceUsingInvalidDescriptorTest::RA3FDevSoundTonePlayToneSequenceUsingInvalidDescriptorTest(const TDesC& aTestName)
  1.8297 +	:	RA3FDevSoundTestBase(aTestName), iInvalidToneSequence(KNullDesC8)
  1.8298 +	{
  1.8299 +	}
  1.8300 +
  1.8301 +RA3FDevSoundTonePlayToneSequenceUsingInvalidDescriptorTest* RA3FDevSoundTonePlayToneSequenceUsingInvalidDescriptorTest::NewL(const TDesC& aTestName)
  1.8302 +	{
  1.8303 +	RA3FDevSoundTonePlayToneSequenceUsingInvalidDescriptorTest * self = new(ELeave)RA3FDevSoundTonePlayToneSequenceUsingInvalidDescriptorTest(aTestName);
  1.8304 +	return self;
  1.8305 +	}
  1.8306 +
  1.8307 +void RA3FDevSoundTonePlayToneSequenceUsingInvalidDescriptorTest::DoKickoffTestL()
  1.8308 +	{
  1.8309 +	TPtrC TS;
  1.8310 +	if ( !GetStringFromConfig(iTestStepName, KInvalidToneSequence,  TS) )
  1.8311 +		{
  1.8312 +		ERR_PRINTF2(KMsgErrorGetParameter, &KInvalidToneSequence);
  1.8313 +		StopTest(KErrNotFound);
  1.8314 +		return;
  1.8315 +		}
  1.8316 +	iInvalidToneSequence.Copy(TS);
  1.8317 +	}
  1.8318 +
  1.8319 +void RA3FDevSoundTonePlayToneSequenceUsingInvalidDescriptorTest::Fsm(TMmfDevSoundEvent aDevSoundEvent,  TInt aError)
  1.8320 +	{
  1.8321 +	switch (iDevSoundState)
  1.8322 +		{
  1.8323 +		case EStateCreated:
  1.8324 +			{
  1.8325 +			__ASSERT_ALWAYS((aError == KErrNone), Panic(_L("RA3FDevSoundTonePlayToneSequenceUsingInvalidDescriptorTest"), EFsmIncorrectErrorPassed));
  1.8326 +			if (aDevSoundEvent == EEventInitialize)
  1.8327 +				{
  1.8328 +				INFO_PRINTF1(_L("Calling iMMFDevSound::InitializeL"));
  1.8329 +				TRAPD(err, iMMFDevSound->InitializeL(*this, EMMFStateTonePlaying));
  1.8330 +				if (err != KErrNone)
  1.8331 +					{
  1.8332 +					ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"),  err);
  1.8333 +					StopTest(err);
  1.8334 +					break;
  1.8335 +					}
  1.8336 +				INFO_PRINTF1(_L("DevSound State: EStateInitializing"));
  1.8337 +				iDevSoundState = EStateInitializing;
  1.8338 +				}
  1.8339 +			else
  1.8340 +				{
  1.8341 +				ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent);
  1.8342 +				StopTest(aError, EFail);
  1.8343 +				}
  1.8344 +			break;
  1.8345 +			}
  1.8346 +		case EStateInitializing:
  1.8347 +			{
  1.8348 +			if (aDevSoundEvent == EEventInitComplete && aError == KErrNone)
  1.8349 +				{
  1.8350 +				INFO_PRINTF1(_L("Calling iMMFDevSound->PlayToneSequenceL with an invalid descriptor as argument"));
  1.8351 +				TRAPD(err, iMMFDevSound->PlayToneSequenceL(iInvalidToneSequence));
  1.8352 +				if (err != KErrNone)
  1.8353 +					{
  1.8354 +					ERR_PRINTF2(_L("CMMFDevSound::PlayToneSequenceL left with error = %d and it should not leave"), err);
  1.8355 +					StopTest(err, EFail);
  1.8356 +					}
  1.8357 +				}
  1.8358 +			else if (aDevSoundEvent == EEventInitComplete && aError != KErrNone)
  1.8359 +				{
  1.8360 +				ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error = %d"), aError);
  1.8361 +				StopTest(aError);
  1.8362 +				}
  1.8363 +			else
  1.8364 +				{
  1.8365 +				ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent);
  1.8366 +				StopTest(aError, EFail);
  1.8367 +				}
  1.8368 +			break;
  1.8369 +			}
  1.8370 +		default:
  1.8371 +			{
  1.8372 +			ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState);
  1.8373 +			StopTest(aError, EFail);
  1.8374 +			}
  1.8375 +		}
  1.8376 +	}
  1.8377 +
  1.8378 +void RA3FDevSoundTonePlayToneSequenceUsingInvalidDescriptorTest::ToneFinished(TInt aError)
  1.8379 +	{
  1.8380 +	INFO_PRINTF1(_L("========== DevSound ToneFinished() callback =========="));
  1.8381 +	if (aError == KErrCorrupt)
  1.8382 +		{
  1.8383 +		INFO_PRINTF2(_L("ToneFinished called with KErrCorrupt %d which is the expected error"), aError);
  1.8384 +		StopTest();
  1.8385 +		}
  1.8386 +	else
  1.8387 +		{
  1.8388 +		ERR_PRINTF3(_L("ToneFinished called with error = %d, when the expected error is = %d"), aError, KErrCorrupt);
  1.8389 +		StopTest(aError, EFail);
  1.8390 +		}
  1.8391 +	}
  1.8392 +