multimediacommsengine/tsrc/MMCTestDriver/MCETester/src/TCmdSendRefer.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 "TCmdSendRefer.h"
       
    22 #include "CTcMCEContext.h"
       
    23 
       
    24 #include <MceOutRefer.h>
       
    25 #include <MceOutRefer.h>
       
    26 #include <MCEEvent.h>
       
    27 
       
    28 void TCmdSendRefer::ExecuteL()
       
    29 	{	
       
    30 	// ---------- Setup --------------------------------------------------------
       
    31 
       
    32 	// Get refer
       
    33 	CMceOutRefer* refer = 
       
    34 	    reinterpret_cast<CMceOutRefer*>(GetObjectForIdL(KReferId, ETrue));			
       
    35 	
       
    36 	// Get Headers
       
    37 	CDesC8Array* headers = ExtractHeadersL( EFalse );
       
    38 	CleanupStack::PushL(headers);
       
    39 	
       
    40 	// Get ContentType
       
    41 	HBufC8* contentType = HBufCParameterL(ExtractTextL(KParamContentType, 
       
    42 													   EFalse));		
       
    43 	CleanupStack::PushL(contentType);
       
    44 	
       
    45 	// Get Body
       
    46 	HBufC8* body = HBufCParameterL(ExtractTextL(KParamBody, EFalse));
       
    47 	CleanupStack::PushL(body);
       
    48 
       
    49 	CMceOutEvent* outEventRefer = NULL;
       
    50 	
       
    51 	// ---------- Execution ----------------------------------------------------
       
    52 
       
    53     outEventRefer = refer->ReferL( headers, contentType, body );
       
    54     
       
    55 	TPtrC8 outEventName;
       
    56 	if (outEventRefer)
       
    57 		{
       
    58 		iContext.Registry().AddObjectL(	outEventRefer );
       
    59 		outEventName.Set(iContext.Registry().ObjectNameL( outEventRefer));	
       
    60 		}
       
    61     CleanupStack::Pop( body );
       
    62     CleanupStack::Pop( contentType );
       
    63     CleanupStack::Pop( headers );
       
    64 
       
    65 	// ---------- Response creation --------------------------------------------
       
    66  
       
    67     AddIdResponseL( KReferId, *refer );
       
    68   
       
    69     if(outEventRefer)
       
    70     	{
       
    71     	AddTextResponseL(KParamNotifyReceiverEventId, outEventName);		
       
    72     	}
       
    73     }
       
    74 	
       
    75 TBool TCmdSendRefer::Match( const TTcIdentifier& aId )
       
    76 	{
       
    77 	return TTcMceCommandBase::Match( aId, _L8("SendRefer") );
       
    78 	}
       
    79 
       
    80 TTcCommandBase* TCmdSendRefer::CreateL( MTcTestContext& aContext )
       
    81 	{
       
    82 	return new( ELeave ) TCmdSendRefer( aContext );
       
    83 	}