os/mm/mmlibs/mmfw/tsrc/mmfintegrationtest/SDevSound/SDSCapTestServer/src/CapTestStep0004.cpp
First public contribution.
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 "CapTestStep0004.h"
18 CSecDevSndTS0004* CSecDevSndTS0004::NewL()
20 CSecDevSndTS0004* self = new (ELeave) CSecDevSndTS0004;
21 CleanupStack::PushL(self);
27 void CSecDevSndTS0004::ConstructL()
29 iIsFirstPlayed = EFalse;
32 void CSecDevSndTS0004::StartProcessing(TRequestStatus& aStatus)
36 if( (iVerdict = DoTestStepPreambleL() ) == EPass )
38 iVerdict = DoPlayDTMFTone();
42 CSecDevSndTS0004::~CSecDevSndTS0004()
46 /******************************************************************************
50 *****************************************************************************/
59 TVerdict CSecDevSndTS0004::DoPlayDTMFTone()
61 _LIT(KDTMFStringShort,"0");
62 _LIT(KDTMFString,"11111, 11111, 11111111");
65 TVerdict initOK = TestInitialize(EMMFStateTonePlaying);
71 TestSetPriority(KDevSoundPriorityHigh);
72 TestSetVolume(iMMFDevSound->MaxVolume());
74 iExpectedValue = KErrUnderflow;
75 TestPlayDTMFString(KDTMFStringShort);
76 iExpectedValue = KErrInUse;
77 return TestPlayDTMFString(KDTMFString);
87 TVerdict CSecDevSndTS0004::TestPlayDTMFString(const TDesC &aDTMFString)
89 iCallbackError = KErrNone;
93 TRAPD(err, iMMFDevSound->PlayDTMFStringL(aDTMFString));
101 // Start the active scheduler and catch the callback
102 CActiveScheduler::Start();
103 if (iCallbackError != iExpectedValue)
107 if (iCallbackArray[EToneFinished] != 1)
111 TInt tot = GetCallbackTotal();
120 /******************************************************************************
122 * DevSound mixin methods
124 *****************************************************************************/
132 void CSecDevSndTS0004::ToneFinished (TInt aError)
134 if( !iIsFirstPlayed )
136 // after first tone played inform client so we can be interrupted during second play
137 iIsFirstPlayed = ETrue;
138 User::RequestComplete(iStatus, aError);
140 iCallbackArray[EToneFinished] ++;
141 iCallbackError = aError;
142 CActiveScheduler::Stop();