sl@0
|
1 |
// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of the License "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
// e32test\device\t_usb.cpp
|
sl@0
|
15 |
// USB Test Program, main part.
|
sl@0
|
16 |
// Device-side part, to work against USBRFLCT running on the host.
|
sl@0
|
17 |
//
|
sl@0
|
18 |
//
|
sl@0
|
19 |
|
sl@0
|
20 |
#include "t_usb.h"
|
sl@0
|
21 |
|
sl@0
|
22 |
|
sl@0
|
23 |
void RunAppL(TBool aVerboseOutput)
|
sl@0
|
24 |
{
|
sl@0
|
25 |
RDebug::Print(_L("RunAppL()"));
|
sl@0
|
26 |
// Construct the active scheduler
|
sl@0
|
27 |
CActiveScheduler* myScheduler = new (ELeave) CActiveScheduler();
|
sl@0
|
28 |
|
sl@0
|
29 |
// Push active scheduler onto the cleanup stack
|
sl@0
|
30 |
CleanupStack::PushL(myScheduler);
|
sl@0
|
31 |
|
sl@0
|
32 |
// Install as the active scheduler
|
sl@0
|
33 |
CActiveScheduler::Install(myScheduler);
|
sl@0
|
34 |
|
sl@0
|
35 |
// Create console handler
|
sl@0
|
36 |
CConsoleBase* myConsole =
|
sl@0
|
37 |
Console::NewL(_L("T_USB - USB Client Test Program"), TSize(KConsFullScreen, KConsFullScreen));
|
sl@0
|
38 |
CleanupStack::PushL(myConsole);
|
sl@0
|
39 |
|
sl@0
|
40 |
CActiveConsole* myActiveConsole = CActiveConsole::NewL(myConsole, aVerboseOutput);
|
sl@0
|
41 |
CleanupStack::PushL(myActiveConsole);
|
sl@0
|
42 |
|
sl@0
|
43 |
// Call request function
|
sl@0
|
44 |
myActiveConsole->RequestCharacter();
|
sl@0
|
45 |
|
sl@0
|
46 |
// Start active scheduler
|
sl@0
|
47 |
CActiveScheduler::Start();
|
sl@0
|
48 |
|
sl@0
|
49 |
// Suspend thread for 2 secs
|
sl@0
|
50 |
User::After(2000000);
|
sl@0
|
51 |
|
sl@0
|
52 |
CleanupStack::PopAndDestroy(3); // myActiveConsole, myConsole, myScheduler
|
sl@0
|
53 |
return;
|
sl@0
|
54 |
}
|
sl@0
|
55 |
|
sl@0
|
56 |
|
sl@0
|
57 |
TInt E32Main()
|
sl@0
|
58 |
{
|
sl@0
|
59 |
RDebug::Print(_L("E32Main()"));
|
sl@0
|
60 |
|
sl@0
|
61 |
CTrapCleanup* cleanup = CTrapCleanup::New(); // get clean-up stack
|
sl@0
|
62 |
|
sl@0
|
63 |
__UHEAP_MARK;
|
sl@0
|
64 |
|
sl@0
|
65 |
_LIT(KArg, "verbose");
|
sl@0
|
66 |
TBuf<64> c;
|
sl@0
|
67 |
User::CommandLine(c);
|
sl@0
|
68 |
TBool verbose = EFalse;
|
sl@0
|
69 |
if (c.CompareF(KArg) == 0)
|
sl@0
|
70 |
{
|
sl@0
|
71 |
RDebug::Print(_L("(Verbose output enabled.)\n"));
|
sl@0
|
72 |
verbose = ETrue;
|
sl@0
|
73 |
}
|
sl@0
|
74 |
|
sl@0
|
75 |
TRAPD(error, RunAppL(verbose));
|
sl@0
|
76 |
|
sl@0
|
77 |
__ASSERT_ALWAYS(!error, User::Panic(_L("T_USB: EPOC32EX"), error));
|
sl@0
|
78 |
|
sl@0
|
79 |
__UHEAP_MARKEND;
|
sl@0
|
80 |
|
sl@0
|
81 |
delete cleanup; // destroy clean-up stack
|
sl@0
|
82 |
|
sl@0
|
83 |
RDebug::Print(_L("Program exit: done.\n"));
|
sl@0
|
84 |
|
sl@0
|
85 |
return 0; // and return
|
sl@0
|
86 |
}
|
sl@0
|
87 |
|
sl@0
|
88 |
|
sl@0
|
89 |
// -eof-
|