multimediacommsengine/tsrc/MMCTestDriver/MCETester/src/TCmdGetStreamState.cpp
changeset 0 1bce908db942
equal deleted inserted replaced
-1:000000000000 0:1bce908db942
       
     1 /*
       
     2 * Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:    Implementation
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #include "MCEConstants.h"
       
    21 #include "CTcMCEMultimediaAPIObserver.h"
       
    22 
       
    23 #include "TCmdGetStreamState.h"
       
    24 #include "CTcMCEContext.h"
       
    25 
       
    26 #include <MceMediaStream.h>
       
    27 #include <MceMediaSink.h>
       
    28 #include <MceMediaSource.h>
       
    29 
       
    30 void TCmdGetStreamState::ExecuteL()
       
    31 	{	
       
    32 	// ---------- Setup --------------------------------------------------------
       
    33 	
       
    34 	// Get an item off the receive queue (waits until timeout if none is present)
       
    35 
       
    36 	TInt timeout = ExtractIntegerL( KParamTimeout, KDefaultReceiveTimeout, 
       
    37 									EFalse );
       
    38 	CTcMCEReceived& item = iContext.ReceivedStreamItemL( timeout );	
       
    39 
       
    40  	CMceMediaStream* expectedStream = reinterpret_cast<CMceMediaStream*>
       
    41  		(GetObjectForIdL(KStreamId, EFalse));
       
    42 /*
       
    43     if ( expectedStream )
       
    44         {
       
    45         if ( item.MediaStream() != expectedStream )
       
    46             {
       
    47             // If the first item's containing stream is not the expected
       
    48             User::Leave( KErrNotFound );
       
    49             }
       
    50         }
       
    51  */
       
    52  
       
    53  	CTcMCEMultimediaAPIObserver &mObserver = iContext.MultimediaObserver();
       
    54  
       
    55  	CMceMediaStream& aStream = *expectedStream;
       
    56  	
       
    57  	mObserver.StreamStateChanged(aStream);
       
    58  	
       
    59  	CMceMediaStream::TState state = aStream.State();
       
    60       
       
    61 	// ---------- Execution ----------------------------------------------------
       
    62 
       
    63 	// It is not quaranteed that MediaStream object is not necessarily valid
       
    64 	// when the event will be fetched from the queue. Only the data
       
    65 	// stored when the event was being received can be used.
       
    66 
       
    67 	// ---------- Response creation --------------------------------------------
       
    68 
       
    69 	AddIdResponseL( KStreamId, aStream );
       
    70     
       
    71 
       
    72 //	AddIdResponseL( KSinkId, aStream.Sinks() );
       
    73 
       
    74 	AddIdResponseL( KSourceId, *(aStream.Source()) );
       
    75 	 
       
    76 	AddIntegerResponseL(KResponseMediaStreamState, state);
       
    77 	AddTextualMediaStreamStateL(state); 
       
    78 	
       
    79 	}
       
    80 	
       
    81 TBool TCmdGetStreamState::Match( const TTcIdentifier& aId )
       
    82 	{
       
    83 	return TTcMceCommandBase::Match( aId, _L8("GetStreamState") );
       
    84 	}
       
    85 
       
    86 TTcCommandBase* TCmdGetStreamState::CreateL( MTcTestContext& aContext )
       
    87 	{
       
    88 	return new( ELeave ) TCmdGetStreamState( aContext );
       
    89 	}