testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/pipslogger/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 <test/testexecutepipslog.h>
       
    27 #include "server.h"
       
    28 
       
    29 // Emulator EKA1 is the only DLL case
       
    30 // EKA2 all variats & EKA1 target only
       
    31 // E32Main calls MainL()
       
    32 LOCAL_C void MainL()
       
    33 /**
       
    34  * Secure variant
       
    35  * Much simpler, uses the new Rendezvous() call to sync with the client
       
    36  */
       
    37 	{
       
    38 	// Leave Platform security hooks in place
       
    39 #if (defined __DATA_CAGING__)
       
    40 	RProcess().DataCaging(RProcess::EDataCagingOn);
       
    41 	RProcess().SecureApi(RProcess::ESecureApiOn);
       
    42 #endif
       
    43 	CActiveScheduler* sched=NULL;
       
    44 	sched=new(ELeave) CActiveScheduler;
       
    45 	CActiveScheduler::Install(sched);
       
    46 	CLogServer* server = NULL;
       
    47 	// Create the sever
       
    48 	TRAPD(err,server = CLogServer::NewL());
       
    49 	if(!err)
       
    50 		{
       
    51 		// Client Synchronisation different for EKA1 and EKA2
       
    52 		// EKA2 really simple. Client blocks on reciprocal Rendezvous call
       
    53 		RProcess::Rendezvous(KErrNone);
       
    54 		// Go into the Active scheduler
       
    55 		sched->Start();
       
    56 		// Free the server class
       
    57 		delete server;
       
    58 		}
       
    59 	sched->Stop() ; 
       
    60 	delete sched;
       
    61 	}
       
    62 
       
    63 //GLDEF_C TInt E32Main()
       
    64 //this being an OE application we shall use 
       
    65 // the OE provided main signature
       
    66 int main(int,char**,char* )
       
    67 /**
       
    68  * @return - Standard Epoc error code on process exit
       
    69  * Process entry point. Called by client using RProcess API
       
    70  */
       
    71 	{
       
    72 	__UHEAP_MARK;
       
    73 	CTrapCleanup* cleanup = CTrapCleanup::New();
       
    74 	if(cleanup == NULL)
       
    75 		{
       
    76 		return KErrNoMemory;
       
    77 		}
       
    78 	TRAP_IGNORE(MainL());
       
    79 	delete cleanup;
       
    80 	__UHEAP_MARKEND;
       
    81 	return KErrNone;
       
    82     }
       
    83 
       
    84