multimediacommsengine/tsrc/testdriver/siptester/src/TCmdCreateManagedProfileRegistry.cpp
changeset 0 1bce908db942
equal deleted inserted replaced
-1:000000000000 0:1bce908db942
       
     1 /*
       
     2 * Copyright (c) 2004 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 #include "CTcSIPContext.h"
       
    19 #include "SIPConstants.h"
       
    20 #include "TCmdCreateManagedProfileRegistry.h"
       
    21 #include "TCmdCreateProfile.h"
       
    22 
       
    23 #include <sipmanagedprofile.h>
       
    24 #include <sipmanagedprofileregistry.h>
       
    25 #include "tclog.h"
       
    26 
       
    27 #include "CTcSIPProfileContainer.h"
       
    28 /**
       
    29  * INPUT:
       
    30  *   Headers:		-
       
    31  *   Parameters:	ProfileType*
       
    32  *   IDs:           -
       
    33  *
       
    34  * OUTPUT:
       
    35  *   Parameters:	-
       
    36  *   IDs:			RegistryId
       
    37  */
       
    38 void TCmdCreateManagedProfileRegistry::ExecuteL()
       
    39 	{
       
    40 	// -- Setup ---------------------------------------------------------------
       
    41 
       
    42     // Create a new profile, if type parameter is not found use default 
       
    43 	// Internet, IETF
       
    44 	CSIPManagedProfile* registry = NULL;
       
    45 	CTcStructure* structure = FindStructureL( KParamProfileType, EFalse );
       
    46 	if( structure )
       
    47 	    {
       
    48 	    registry = iContext.Profile().ManagedProfileRegistry().CreateL( 
       
    49 	                    TCmdCreateProfile::ProfileTypeInfoL( structure ) );
       
    50 	    }
       
    51 	else
       
    52 	    {
       
    53 	    TSIPProfileTypeInfo typeInfo;
       
    54 	    typeInfo.iSIPProfileClass = TSIPProfileTypeInfo::EInternet;
       
    55 	    typeInfo.iSIPProfileName = KIETF;
       
    56 	    registry = iContext.Profile().ManagedProfileRegistry().CreateL( typeInfo );
       
    57 	    }
       
    58 	CleanupStack::PushL( registry );
       
    59 	
       
    60 	// -- Execution -----------------------------------------------------------
       
    61 	
       
    62 	// Saving the profile
       
    63 	iContext.Profile().ManagedProfileRegistry().SaveL( *registry );
       
    64 
       
    65 	CleanupStack::Pop( registry );
       
    66 
       
    67 	// -- Response creation ---------------------------------------------------
       
    68 
       
    69 	// Add RegistryId to response
       
    70     AddIdResponseL( KRegistryId, registry );
       
    71 	}
       
    72 
       
    73 TBool TCmdCreateManagedProfileRegistry::Match( const TTcIdentifier& aId )
       
    74 	{
       
    75 	return TTcSIPCommandBase::Match( aId, _L8("CreateManagedProfileRegistry") );
       
    76 	}
       
    77 
       
    78 TTcCommandBase* TCmdCreateManagedProfileRegistry::CreateL( MTcTestContext& aContext )
       
    79 	{
       
    80 	return new( ELeave ) TCmdCreateManagedProfileRegistry( aContext );
       
    81 	}
       
    82