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