graphicsapitest/graphicssvs/fbserv/src/T_FBServAPIServer.cpp
changeset 103 2717213c588a
parent 98 bf7481649c98
child 116 171fae344dd4
child 121 d72fc2aace31
child 187 9f66f99ee56f
equal deleted inserted replaced
98:bf7481649c98 103:2717213c588a
     1 /*
       
     2 * Copyright (c) 2005-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 "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 *
       
    16 */
       
    17 
       
    18 /**
       
    19 @test
       
    20 @internalComponent
       
    21 
       
    22 The main entry point for the TEF Server T_FBServAPIAddr.exe
       
    23 */
       
    24 
       
    25 //	User Includes
       
    26 #include "T_FBServAPIServer.h"
       
    27 
       
    28 CT_FBServAPIServer* CT_FBServAPIServer::NewL()
       
    29 /**
       
    30  * @return - Instance of the test server
       
    31  * Same code for Secure and non-secure variants
       
    32  * Called inside the MainL() function to create and start the
       
    33  * CTestServer derived server.
       
    34  */
       
    35 	{
       
    36 	CT_FBServAPIServer* server = new (ELeave) CT_FBServAPIServer();
       
    37 	CleanupStack::PushL(server);
       
    38 	server->ConstructL();
       
    39 	CleanupStack::Pop(server);
       
    40 	return server;
       
    41 	}
       
    42 
       
    43 LOCAL_C void MainL()
       
    44 /**
       
    45  * Secure variant
       
    46  * Much simpler, uses the new Rendezvous() call to sync with the client
       
    47  */
       
    48 	{
       
    49 #if (defined __DATA_CAGING__)
       
    50 	RProcess().DataCaging(RProcess::EDataCagingOn);
       
    51 	RProcess().SecureApi(RProcess::ESecureApiOn);
       
    52 #endif
       
    53 	CActiveScheduler* sched=NULL;
       
    54 	sched=new(ELeave) CActiveScheduler;
       
    55 	CActiveScheduler::Install(sched);
       
    56 	CT_FBServAPIServer* server = NULL;
       
    57 	TRAPD(err, server = CT_FBServAPIServer::NewL());
       
    58 	if(!err)
       
    59 		{
       
    60 		RProcess::Rendezvous(KErrNone);
       
    61 		sched->Start();
       
    62 		}
       
    63 	delete server;
       
    64 	delete sched;
       
    65 	}
       
    66 
       
    67 GLDEF_C TInt E32Main()
       
    68 /**
       
    69  * @return - Standard Epoc error code on process exit
       
    70  * Secure variant only
       
    71  * Process entry point. Called by client using RProcess API
       
    72  */
       
    73 	{
       
    74 	CTrapCleanup* cleanup = CTrapCleanup::New();
       
    75 	if(cleanup == NULL)
       
    76 		{
       
    77 		return KErrNoMemory;
       
    78 		}
       
    79 	TRAP_IGNORE(MainL());
       
    80 	delete cleanup;
       
    81 	return KErrNone;
       
    82     }