diff -r 000000000000 -r 1bce908db942 multimediacommsengine/tsrc/MMCTestDriver/MCETester/src/TCmdGetSourceStatus.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/multimediacommsengine/tsrc/MMCTestDriver/MCETester/src/TCmdGetSourceStatus.cpp Tue Feb 02 01:04:58 2010 +0200 @@ -0,0 +1,107 @@ +/* +* 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 "TCmdGetSourceStatus.h" +#include "CTcMCEContext.h" +#include +#include +#include + +#include +#include +#include +#include +#include + +void TCmdGetSourceStatus::ExecuteL() + { + // ---------- Setup -------------------------------------------------------- + + // Get stream + CMceMediaStream* mediaStream = reinterpret_cast + (GetObjectForIdL(KStreamId, ETrue)); + + CMceMediaStream* stream = NULL; + + if ( mediaStream->Type() == KMceAudio ) + { + stream = dynamic_cast(mediaStream); + } + else if( mediaStream->Type() == KMceVideo ) + { + stream = dynamic_cast(mediaStream); + } + else + { + User::Leave( KErrNotSupported ); + } + + + // ---------- Execution ---------------------------------------------------- + AddIdResponseL( KStreamId, *mediaStream ); + + // Get source + const CMceMediaSource* source = stream->Source(); + + TBool sourceState = EFalse; + + if( source->Type() == KMceCameraSource) + { + sourceState = source->IsEnabled(); + AddBooleanResponseL( KValueSourceCamera, sourceState); + } + else if( source->Type() == KMceFileSource) + { + sourceState = source->IsEnabled(); + AddBooleanResponseL( KValueSourceFile, sourceState); + } + else if( source->Type() == KMceMicSource) + { + sourceState = source->IsEnabled(); + AddBooleanResponseL( KValueSourceMic,sourceState); + } + else if( source->Type() == KMceRTPSource) + { + sourceState = source->IsEnabled(); + AddBooleanResponseL( KValueSourceRTP,sourceState); + } + else + { + + AddBooleanResponseL( KValueSourceUnknown,sourceState); + } + + + // ---------- Response creation -------------------------------------------- + + AddIdResponseL( KStreamId, *stream ); + // Sink added to response during execution + + } + +TBool TCmdGetSourceStatus::Match( const TTcIdentifier& aId ) + { + return TTcMceCommandBase::Match( aId, _L8("GetSourceStatus") ); + } + +TTcCommandBase* TCmdGetSourceStatus::CreateL( MTcTestContext& aContext ) + { + return new( ELeave ) TCmdGetSourceStatus( aContext ); + }