multimediacommsengine/tsrc/MMCTestDriver/MCETester/src/TCmdSendAcceptEvent.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 "TCmdSendAcceptEvent.h"
       
    22 #include "CTcMCEContext.h"
       
    23 #include <MceInEvent.h>
       
    24 
       
    25 void TCmdSendAcceptEvent::ExecuteL()
       
    26 	{	
       
    27 	// ---------- Setup --------------------------------------------------------
       
    28 
       
    29 	// Get event
       
    30 	CMceInEvent* event = reinterpret_cast<CMceInEvent*>
       
    31 		(GetObjectForIdL(KEventId, ETrue));	
       
    32 
       
    33 	// ---------- Execution ----------------------------------------------------
       
    34 
       
    35 	// Get reasonphrase
       
    36 	TPtrC8 reason = ExtractTextL(KParamReasonPhrase, EFalse);
       
    37 		
       
    38 	// Get statuscode
       
    39 	TInt status = ExtractIntegerL(KParamStatusCode, 0, EFalse);
       
    40 	
       
    41 	// Get Headers
       
    42 	CDesC8Array* headers = ExtractHeadersL( EFalse );
       
    43 	CleanupStack::PushL(headers);
       
    44 
       
    45 	// Accept
       
    46 	if( reason == KNullDesC8 && status == 0 && !headers )  
       
    47 		{
       
    48 		CleanupStack::PopAndDestroy(headers);
       
    49 		event->AcceptL();
       
    50 		}
       
    51 	else
       
    52 		{
       
    53 		event->RespondL( reason, status, headers );
       
    54 		CleanupStack::Pop(headers);
       
    55 		}
       
    56 
       
    57 	CMceEvent::TState state = event->State();		
       
    58 	
       
    59 	// ---------- Response creation --------------------------------------------
       
    60  
       
    61  	AddIdResponseL( KEventId, *event );
       
    62 
       
    63 	// Add Event state	
       
    64 	AddIntegerResponseL( KResponseEventState, state );
       
    65 	AddTextualEventStateL( state );
       
    66 	
       
    67 	}
       
    68 	
       
    69 TBool TCmdSendAcceptEvent::Match( const TTcIdentifier& aId )
       
    70 	{
       
    71 	return TTcMceCommandBase::Match( aId, _L8("SendAcceptEvent") );
       
    72 	}
       
    73 
       
    74 TTcCommandBase* TCmdSendAcceptEvent::CreateL( MTcTestContext& aContext )
       
    75 	{
       
    76 	return new( ELeave ) TCmdSendAcceptEvent( aContext );
       
    77 	}