--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/multimediacommsengine/tsrc/MMCTestDriver/MCETester/src/TCmdSetSource.cpp Tue Feb 02 01:04:58 2010 +0200
@@ -0,0 +1,91 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Implementation
+*
+*/
+
+
+
+#include "MCEConstants.h"
+#include "TCmdSetSource.h"
+#include "CTcMCEContext.h"
+#include <MceMediaStream.h>
+#include <MCEAudioStream.h>
+#include <MceRtpSource.h>
+#include <MCEMicSource.h>
+
+void TCmdSetSource::ExecuteL()
+ {
+ // ---------- Setup --------------------------------------------------------
+
+ // Get stream
+ CMceMediaStream* mediaStream = reinterpret_cast<CMceMediaStream*>
+ (GetObjectForIdL(KStreamId, ETrue));
+
+ if ( mediaStream->Type() != KMceAudio )
+ {
+ User::Leave( KErrNotSupported );
+ }
+
+ CMceAudioStream* audioStream = static_cast<CMceAudioStream*>(mediaStream);
+
+ // Get type
+ TPtrC8 source = ExtractTextL( KParamSource, ETrue );
+
+ //get the inactivity timer value for rtp source
+ TInt rtpInactivityTimer = ExtractIntegerL(KParamRTPInactivityTimer, 0, EFalse);
+
+ // ---------- Execution ----------------------------------------------------
+
+ if (source == KValueSourceRTP )
+ {
+ CMceRtpSource* rtpSource = NULL;
+
+ if(rtpInactivityTimer != 0)
+ rtpSource = CMceRtpSource::NewLC(KMceJitterBufferLength, KMceJitterBufferTreshold, rtpInactivityTimer * 1000);
+ else
+ rtpSource = CMceRtpSource::NewLC();
+
+ audioStream->SetSourceL(rtpSource);
+ CleanupStack::Pop(rtpSource);
+ AddIdResponseL( KSourceId, *rtpSource );
+ }
+ else if (source == KValueSourceMic )
+ {
+ CMceMicSource* mic = CMceMicSource::NewLC();
+ audioStream->SetSourceL(mic);
+ CleanupStack::Pop(mic);
+ AddIdResponseL( KSourceId, *mic );
+ }
+ else
+ {
+ User::Leave( KErrNotSupported );
+ }
+
+ // ---------- Response creation --------------------------------------------
+
+ AddIdResponseL( KStreamId, *audioStream );
+ // Source added to response during execution
+
+ }
+
+TBool TCmdSetSource::Match( const TTcIdentifier& aId )
+ {
+ return TTcMceCommandBase::Match( aId, _L8("SetSource") );
+ }
+
+TTcCommandBase* TCmdSetSource::CreateL( MTcTestContext& aContext )
+ {
+ return new( ELeave ) TCmdSetSource( aContext );
+ }