testexecfw/stf/stffw/eventsystem/server/src/main.cpp
changeset 2 8bb370ba6d1d
equal deleted inserted replaced
1:bbd31066657e 2:8bb370ba6d1d
       
     1 /*
       
     2 * Copyright (c) 2010 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 //  Include Files  
       
    19 
       
    20 #include <e32base.h>
       
    21 #include <e32std.h>
       
    22 #include <e32svr.h>
       
    23 
       
    24 #include "stfeventsystemdefs.h"
       
    25 #include "eventsystemserver.h"
       
    26 
       
    27 //  Local Functions
       
    28 
       
    29 // TestEngine server starter
       
    30 LOCAL_C void RunEventSystemServerL()
       
    31     {
       
    32     RDebug::Print(_L("STF [ESS]: RunEventSystemServerL start"));
       
    33     // Naming the server thread after the server helps to debug panics
       
    34     User::LeaveIfError(RProcess::RenameMe(KEventSystemServName));
       
    35     
       
    36     // Create and install active scheduler
       
    37     CActiveScheduler* scheduler = new (ELeave) CActiveScheduler;
       
    38     CleanupStack::PushL(scheduler);
       
    39     CActiveScheduler::Install(scheduler);
       
    40     
       
    41     // Create TestEngine server and leave it on the cleanup stack
       
    42     CEventSystemServer* eventSystemServer = CEventSystemServer::NewLC(CActive::EPriorityStandard);
       
    43     
       
    44     // Initialisation complete, now signal the client
       
    45     RProcess::Rendezvous(KErrNone);
       
    46     
       
    47     // Ready to run
       
    48     CActiveScheduler::Start();
       
    49     
       
    50     // Cleanup the server and scheduler
       
    51     CleanupStack::PopAndDestroy(eventSystemServer);
       
    52     CleanupStack::PopAndDestroy(scheduler);
       
    53     RDebug::Print(_L("STF [ESS]: RunEventSystemServerL end"));
       
    54     }
       
    55 
       
    56 //  Global Functions
       
    57 GLDEF_C TInt E32Main()
       
    58     {
       
    59     RDebug::Print(_L("STF [ESS]: E32Main of EventServer start"));
       
    60     __UHEAP_MARK;
       
    61     CTrapCleanup* cleanup = CTrapCleanup::New();
       
    62     TInt r = KErrNoMemory;
       
    63     if(cleanup)
       
    64         {
       
    65         TRAP(r, RunEventSystemServerL());
       
    66         delete cleanup;
       
    67         }
       
    68     __UHEAP_MARKEND;
       
    69     RDebug::Print(_L("STF [ESS]: E32Main of EventServer end result=[%d]"), r);
       
    70     return r;
       
    71     }
       
    72 
       
    73 // EOF