testexecfw/stf/stfext/testmodules/teftestmod/testexecmdw/filelogger/src/main.cpp
changeset 2 8bb370ba6d1d
equal deleted inserted replaced
1:bbd31066657e 2:8bb370ba6d1d
       
     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 * Server entry points
       
    16 * EKA1 & EKA2
       
    17 * EKA1 & WINS is a DLL. All others are exe's
       
    18 *
       
    19 */
       
    20 
       
    21 
       
    22 
       
    23 /**
       
    24  @file Main.cpp
       
    25 */
       
    26 #include <rfilelogger.h>
       
    27 #include "server.h"
       
    28 
       
    29 // Emulator EKA1 is the only DLL case
       
    30 
       
    31 // EKA2 all variats & EKA1 target only
       
    32 // E32Main calls MainL()
       
    33 LOCAL_C void MainL()
       
    34 /**
       
    35  * Secure variant
       
    36  * Much simpler, uses the new Rendezvous() call to sync with the client
       
    37  */
       
    38 	{
       
    39 	// Leave Platform security hooks in place
       
    40 #if (defined __DATA_CAGING__)
       
    41 	RProcess().DataCaging(RProcess::EDataCagingOn);
       
    42 	RProcess().SecureApi(RProcess::ESecureApiOn);
       
    43 #endif
       
    44 	CActiveScheduler* sched=NULL;
       
    45 	sched=new(ELeave) CActiveScheduler;
       
    46 	CActiveScheduler::Install(sched);
       
    47 	CLogServer* server = NULL;
       
    48 	// Create the sever
       
    49 	TRAPD(err,server = CLogServer::NewL());
       
    50 	if(!err)
       
    51 		{
       
    52 		// Client Synchronisation different for EKA1 and EKA2
       
    53 		// EKA2 really simple. Client blocks on reciprocal Rendezvous call
       
    54 		RProcess::Rendezvous(KErrNone);
       
    55 		// Go into the Active scheduler
       
    56 		sched->Start();
       
    57 		}
       
    58 	// Free the server class
       
    59 	delete server;
       
    60 	delete sched;
       
    61 	}
       
    62 
       
    63 GLDEF_C TInt E32Main()
       
    64 /**
       
    65  * @return - Standard Epoc error code on process exit
       
    66  * Process entry point. Called by client using RProcess API
       
    67  */
       
    68 	{
       
    69 	__UHEAP_MARK;
       
    70 	CTrapCleanup* cleanup = CTrapCleanup::New();
       
    71 	if(cleanup == NULL)
       
    72 		{
       
    73 		return KErrNoMemory;
       
    74 		}
       
    75 	TRAP_IGNORE(MainL());
       
    76 	delete cleanup;
       
    77 	__UHEAP_MARKEND;
       
    78 	return KErrNone;
       
    79     }