dbgagents/trkagent/toolsstarter/toolsstarterserver/src/toolsserver.cpp
changeset 0 c6b0df440bee
equal deleted inserted replaced
-1:000000000000 0:c6b0df440bee
       
     1 /*
       
     2 * Copyright (c) 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 //  Include Files  
       
    19 
       
    20 #include "toolsserver.h"
       
    21 #include <e32base.h>
       
    22 #include <e32std.h>
       
    23 #include <e32cons.h>			// Console
       
    24 
       
    25 //  Constants
       
    26 
       
    27 _LIT(KTextConsoleTitle, "Console");
       
    28 _LIT(KTextFailed, " failed, leave code = %d");
       
    29 _LIT(KTextPressAnyKey, " [press any key]\n");
       
    30 
       
    31 //  Global Variables
       
    32 
       
    33 LOCAL_D CConsoleBase* console; // write all messages to this
       
    34 
       
    35 
       
    36 //  Local Functions
       
    37 
       
    38 LOCAL_C void MainL()
       
    39     {
       
    40     //
       
    41     // add your program code here, example code below
       
    42     //
       
    43     console->Write(_L("Hello, world!\n"));
       
    44     }
       
    45 
       
    46 LOCAL_C void DoStartL()
       
    47     {
       
    48     // Create active scheduler (to run active objects)
       
    49     CActiveScheduler* scheduler = new (ELeave) CActiveScheduler();
       
    50     CleanupStack::PushL(scheduler);
       
    51     CActiveScheduler::Install(scheduler);
       
    52 
       
    53     MainL();
       
    54 
       
    55     // Delete active scheduler
       
    56     CleanupStack::PopAndDestroy(scheduler);
       
    57     }
       
    58 
       
    59 //  Global Functions
       
    60 /*
       
    61 GLDEF_C TInt E32Main()
       
    62     {
       
    63     // Create cleanup stack
       
    64     __UHEAP_MARK;
       
    65     CTrapCleanup* cleanup = CTrapCleanup::New();
       
    66 
       
    67     // Create output console
       
    68     TRAPD(createError, console = Console::NewL(KTextConsoleTitle, TSize(
       
    69             KConsFullScreen, KConsFullScreen)));
       
    70     if (createError)
       
    71         return createError;
       
    72 
       
    73     // Run application code inside TRAP harness, wait keypress when terminated
       
    74     TRAPD(mainError, DoStartL());
       
    75     if (mainError)
       
    76         console->Printf(KTextFailed, mainError);
       
    77     console->Printf(KTextPressAnyKey);
       
    78     console->Getch();
       
    79 
       
    80     delete console;
       
    81     delete cleanup;
       
    82     __UHEAP_MARKEND;
       
    83     return KErrNone;
       
    84     }
       
    85 
       
    86 */