multimediacommsengine/tsrc/MMCTestDriver/MCETester/src/TCmdSendTerminateEvent.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 "TCmdSendTerminateEvent.h"
       
    22 #include "CTcMCEContext.h"
       
    23 #include "MCEEvent.h"
       
    24 
       
    25 void TCmdSendTerminateEvent::ExecuteL()
       
    26 	{	
       
    27 	// ---------- Setup --------------------------------------------------------
       
    28 	
       
    29 	// Get event
       
    30 	CMceEvent* event = 
       
    31 		reinterpret_cast<CMceEvent*>(GetObjectForIdL(KEventId, ETrue));	
       
    32 	
       
    33 	// ---------- Execution ----------------------------------------------------
       
    34 	
       
    35 	// Get Headers
       
    36 	CDesC8Array* headers = ExtractHeadersL( EFalse );
       
    37 	if (!headers)
       
    38 	{
       
    39 		headers = new (ELeave) CDesC8ArrayFlat(1);	
       
    40 	}
       
    41 	//headers->AppendL(_L8("event: ttcn"));
       
    42 	CleanupStack::PushL(headers);
       
    43 	
       
    44 	// Get ContentType
       
    45 	HBufC8* contentType = HBufCParameterL(ExtractTextL(KParamContentType, 
       
    46 													   EFalse));		
       
    47 	CleanupStack::PushL(contentType);
       
    48 	
       
    49 	// Get Body
       
    50 	HBufC8* body = HBufCParameterL(ExtractTextL(KParamBody, EFalse));
       
    51 	CleanupStack::PushL(body);
       
    52 	
       
    53 	event->TerminateL(headers, contentType, body);
       
    54 	
       
    55 	CMceEvent::TState eventState = event->State();
       
    56 	
       
    57 	// ---------- Response creation --------------------------------------------
       
    58  
       
    59 	AddIdResponseL(KEventId, *event);
       
    60  
       
    61 	AddIntegerResponseL( KResponseEventState, eventState );
       
    62 	AddTextualEventStateL( eventState );
       
    63 	
       
    64 	CleanupStack::Pop( body );
       
    65     CleanupStack::Pop( contentType );
       
    66     CleanupStack::Pop( headers );
       
    67 
       
    68 	}
       
    69 	
       
    70 TBool TCmdSendTerminateEvent::Match( const TTcIdentifier& aId )
       
    71 	{
       
    72 	return TTcMceCommandBase::Match( aId, _L8("SendTerminateEvent") );
       
    73 	}
       
    74 
       
    75 TTcCommandBase* TCmdSendTerminateEvent::CreateL( MTcTestContext& aContext )
       
    76 	{
       
    77 	return new( ELeave ) TCmdSendTerminateEvent( aContext );
       
    78 	}