os/mm/mmlibs/mmfw/tsrc/mmfintegrationtest/SDevSound/SDSCapTestServer/src/CapTestStep0006.cpp
Update contrib.
1 // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
16 #include "CapTestStep0006.h"
18 CSecDevSndTS0006* CSecDevSndTS0006::NewL()
20 CSecDevSndTS0006* self = new (ELeave) CSecDevSndTS0006;
21 CleanupStack::PushL(self);
27 void CSecDevSndTS0006::ConstructL()
29 iIsFirstPlayed = EFalse;
33 void CSecDevSndTS0006::StartProcessing(TRequestStatus& aStatus)
38 if( (iVerdict = DoTestStepPreambleL() ) == EPass )
40 iVerdict = DoPlayDualTone();
45 CSecDevSndTS0006::~CSecDevSndTS0006()
49 /******************************************************************************
53 *****************************************************************************/
62 const TInt KShortTimeInterval = 1000000;
63 const TInt KLongTimeInterval = 10000000;
65 TVerdict CSecDevSndTS0006::DoPlayDualTone()
69 TTimeIntervalMicroSeconds dur1(KShortTimeInterval);
72 TTimeIntervalMicroSeconds dur2(KLongTimeInterval);
75 TVerdict initOK = TestInitialize(EMMFStateTonePlaying);
81 TestSetPriority(KDevSoundPriorityHigh);
82 TestSetVolume(iMMFDevSound->MaxVolume());
84 iExpectedValue = KErrUnderflow;
85 TestPlayTone(freq1a, freq1b, dur1);
86 iExpectedValue = KErrInUse;
87 return TestPlayTone(freq2a, freq2b, dur2);
98 TVerdict CSecDevSndTS0006::TestPlayTone(TInt aFreq1, TInt aFreq2, TTimeIntervalMicroSeconds aDur)
100 iCallbackError = KErrNone;
104 TRAPD(err, iMMFDevSound->PlayDualToneL(aFreq1, aFreq2, aDur));
107 iCallbackError = err;
112 // Start the active scheduler and catch the callback
113 CActiveScheduler::Start();
114 if (iCallbackError != iExpectedValue)
118 if (iCallbackArray[EToneFinished] != 1)
122 TInt tot = GetCallbackTotal();
131 /******************************************************************************
133 * DevSound mixin methods
135 *****************************************************************************/
143 void CSecDevSndTS0006::ToneFinished (TInt aError)
145 if( !iIsFirstPlayed )
147 // after first tone played inform client so we can be interrupted during second play
148 iIsFirstPlayed = ETrue;
149 User::RequestComplete(iStatus, aError);
151 iCallbackArray[EToneFinished] ++;
152 iCallbackError = aError;
153 CActiveScheduler::Stop();