cryptomgmtlibs/securitycommonutils/test/source/scstestserver/scstestserver.cpp
changeset 8 35751d3474b7
equal deleted inserted replaced
2:675a964f4eb5 8:35751d3474b7
       
     1 /*
       
     2 * Copyright (c) 2007-2009 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 the License "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: 
       
    15 * Implements CScsTestServer.  See class and function definitions
       
    16 * for more information.
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 /**
       
    22  @file
       
    23 */
       
    24 #include <f32file.h>
       
    25 #include "scstestserver.h"
       
    26 #include "scstestclient.h"
       
    27 
       
    28 
       
    29 CScsTestServer* CScsTestServer::NewLC()
       
    30 /**
       
    31 	Factory function allocates a new, initialized instance of CScsTestServer.
       
    32 
       
    33 	@return					New instance of CScsTestServer, which is owned by the
       
    34 							caller and left on the cleanup stack.  On return, the
       
    35 							server has been started.
       
    36  */
       
    37 	{
       
    38 	CScsTestServer* self = new(ELeave) CScsTestServer();
       
    39 	CleanupStack::PushL(self);
       
    40 	RFs fs;
       
    41 	User::LeaveIfError(fs.Connect());
       
    42 	TUint attr;
       
    43 	TInt r = fs.Att(KDisableScsTestServerTimeout(), attr);
       
    44 	if(r == KErrNone)
       
    45 		{
       
    46 		self->ConstructL(0);
       
    47 		}
       
    48 	else
       
    49 		{
       
    50 		self->ConstructL(ScsTestImpl::KShutdownPeriodUs);
       
    51 		}
       
    52 	return self;
       
    53 	}
       
    54 
       
    55 CScsTestServer::CScsTestServer()
       
    56 /**
       
    57 	This private constructor prevents direct instantiation.
       
    58  */
       
    59  :	CScsServer(ScsTestImpl::Version())
       
    60 	{
       
    61 	// empty.
       
    62 	}
       
    63 
       
    64 void CScsTestServer::ConstructL(TInt aShutdownPeriodUs)
       
    65 /**
       
    66 	Secondary initialization initializes the base class and
       
    67 	starts the server.
       
    68  */
       
    69 	{
       
    70 	CScsServer::ConstructL(aShutdownPeriodUs);
       
    71 	StartL(ScsTestImpl::KServerName);
       
    72 	}
       
    73 
       
    74 CScsTestServer::~CScsTestServer()
       
    75 /**
       
    76 	This empty constructor provides a single point of definition.
       
    77  */
       
    78 	{
       
    79 	// empty.
       
    80 	}
       
    81 
       
    82 CScsSession* CScsTestServer::DoNewSessionL(const RMessage2& aMessage)
       
    83 /**
       
    84 	Implement CSessionCountServer by allocating a new instance of CScsSession.
       
    85 
       
    86 	@param	aMessage		Connect message.  Not used.
       
    87 	@return					New, initialized instance of CScsTestSession.
       
    88 							This object will be destroyed by the framework
       
    89 							when the session is closed.
       
    90  */
       
    91 	{
       
    92 	(void) aMessage;
       
    93 
       
    94 	return CScsTestSession::NewL(*this);
       
    95 	}
       
    96 
       
    97 // End of file