usbmgmt/usbmgrtest/t_usb_charging/src/activetest.cpp
changeset 54 320d509f1a12
equal deleted inserted replaced
51:eaaed528d5fd 54:320d509f1a12
       
     1 /*
       
     2 * Copyright (c) 2006-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 <e32base.h>
       
    19 #include <e32cons.h>
       
    20 #include <e32test.h>
       
    21 #include <e32twin.h>
       
    22 #include <e32debug.h>
       
    23 #include "activeconsole.h"
       
    24 #include "OstTraceDefinitions.h"
       
    25 #ifdef OST_TRACE_COMPILER_IN_USE
       
    26 #include "activetestTraces.h"
       
    27 #endif
       
    28 
       
    29 
       
    30 LOCAL_C void ActiveTestL()
       
    31     {
       
    32 	OstTraceFunctionEntry0( _ACTIVETESTL_ENTRY );
       
    33 
       
    34 	CConsoleBase* console = Console::NewL(_L("ACTIVETEST"), TSize(KConsFullScreen, KConsFullScreen));
       
    35 	CleanupStack::PushL(console);
       
    36 
       
    37 	CActiveScheduler* scheduler = new(ELeave) CActiveScheduler;
       
    38 	CleanupStack::PushL(scheduler);
       
    39 	CActiveScheduler::Install(scheduler);
       
    40 
       
    41 	CActiveConsole* activeConsole = CActiveConsole::NewLC(*console);
       
    42 #ifdef COMMANDLINE_PARAM	
       
    43 	activeConsole->RequestCharacter();
       
    44 #endif	
       
    45 	CActiveScheduler::Start();
       
    46 	// NB CActiveScheduler::Start only returns when someone somewhere has 
       
    47 	// called CActiveScheduler::Stop.
       
    48 
       
    49 	CleanupStack::PopAndDestroy(2); // activeConsole, scheduler
       
    50 
       
    51 	console->Printf(_L("\nPress any key"));
       
    52 	console->Getch(); // get and ignore character
       
    53 	CleanupStack::PopAndDestroy(); // console
       
    54 	OstTraceFunctionExit0( _ACTIVETESTL_EXIT );
       
    55 	}
       
    56 
       
    57 GLDEF_C TInt E32Main()
       
    58     {
       
    59 	OstTraceFunctionEntry0( _E32MAIN_ENTRY );
       
    60 	__UHEAP_MARK;
       
    61 	CTrapCleanup* cleanup = CTrapCleanup::New();
       
    62 	TRAPD(error, ActiveTestL());
       
    63 	__ASSERT_ALWAYS(!error, User::Panic(_L("E32Main"), error));
       
    64 	delete cleanup;
       
    65 	__UHEAP_MARKEND;
       
    66 	OstTraceFunctionExit0( _E32MAIN_EXIT );
       
    67 	return KErrNone;
       
    68     }