datacommsserver/networkcontroller/ts_common/Nif.cpp
changeset 0 dfb7c4ff071f
equal deleted inserted replaced
-1:000000000000 0:dfb7c4ff071f
       
     1 // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #include "nifman.h"
       
    17 #include "CStubbedAgent.h"
       
    18 #include "NetConLog.h"
       
    19 
       
    20 CNifAgentBase* Nif::CreateAgentL(const TDesC& aName, const TBool aNewInstance /* = EFalse */)
       
    21 //
       
    22 //  Create a new agent
       
    23 //
       
    24 //  Be careful when using this function!!!  The new agent is pushed onto the cleanup stack and it
       
    25 //  is up to the test case to call either Pop() or PopAndDestroy().
       
    26 //
       
    27 //  See CNetConTest0501::CleanupAgent() and CNetConSelectionRequestTestBase::AddAgentToNetworkL()
       
    28 //  for examples of how to do this.
       
    29 //
       
    30 	{
       
    31 
       
    32 	ASSERT(aNewInstance);
       
    33 	(void)aNewInstance;
       
    34 	
       
    35 	_LIT(KAgentName, "StubbedAgent");
       
    36 
       
    37 	if(aName != KAgentName)
       
    38 		User::Leave(KErrNotFound);
       
    39 
       
    40 	CNifAgentBase* agent = new(ELeave) CStubbedAgent();
       
    41 
       
    42 	// add the agent to the cleanup stack
       
    43 	CleanupStack::PushL(agent);
       
    44 
       
    45 	LOG( NetConLog::Printf(_L("Nif::CreateAgentL() returning a new CStubbedAgent [0x%08x]"), agent); )
       
    46 
       
    47 	return agent;
       
    48 	}
       
    49