multimediacommsengine/tsrc/MMCTestDriver/MCETester/src/TCmdSendDeRegister.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 "TCmdSendDeRegister.h"
       
    22 #include "CTcMCEContext.h"
       
    23 #include "CTcMCEProfileContainer.h"
       
    24 #include <sipprofile.h>
       
    25 
       
    26 void TCmdSendDeRegister::ExecuteL()
       
    27 	{	
       
    28 	// ---------- Setup ------------------------------------
       
    29 	
       
    30 	CTcMCEProfileContainer& profileContainer = SelectProfileL();	
       
    31 	
       
    32 	// ---------- Execution --------------------------------
       
    33 	
       
    34 	TInt profileId = ExtractProfileIdL();
       
    35 	
       
    36 	CSIPProfile* profile = NULL;
       
    37 	if (profileId == 0) 
       
    38 		{
       
    39 		profile = &(profileContainer.GetDefaultProfileL());
       
    40 		}
       
    41 	else
       
    42 		{
       
    43 		profile = &(profileContainer.GetProfileByIdL(profileId)); 
       
    44 		}
       
    45 	    
       
    46 	// Fetch real profileId	
       
    47 	TUint32 longProfileId = 0;
       
    48 	profile->GetParameter( KSIPProfileId, longProfileId );
       
    49 	
       
    50 	// SendRegister, wait until succeeds
       
    51 	profileId = longProfileId;
       
    52 	//Here add unregister
       
    53 	TInt err = profileContainer.DisableProfileL(profileId);
       
    54 
       
    55 	// ---------- Response creation -----------------------
       
    56  	if(err==0)
       
    57  		{
       
    58 		AddIdResponseL(KProfileObj, *profile);
       
    59 		AddIntegerResponseL(KResponseProfileId, profileId);	
       
    60  		}
       
    61  	else
       
    62  		{
       
    63  		AddIdResponseL(KProfileObj, *profile);
       
    64 		AddIntegerResponseL(KResponseProfileId, profileId);	
       
    65 		AddIntegerResponseL(KResponseError, err);	
       
    66  		}
       
    67 
       
    68 	}
       
    69 	
       
    70 TBool TCmdSendDeRegister::Match( const TTcIdentifier& aId )
       
    71 	{
       
    72 	return TTcMceCommandBase::Match( aId, _L8("SendDeRegister") );
       
    73 	}
       
    74 
       
    75 TTcCommandBase* TCmdSendDeRegister::CreateL( MTcTestContext& aContext )
       
    76 	{
       
    77 	return new( ELeave ) TCmdSendDeRegister( aContext );
       
    78 	}