24
|
1 |
// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
2 |
// All rights reserved.
|
|
3 |
// This component and the accompanying materials are made available
|
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
|
5 |
// which accompanies this distribution, and is available
|
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
7 |
//
|
|
8 |
// Initial Contributors:
|
|
9 |
// Nokia Corporation - initial contribution.
|
|
10 |
//
|
|
11 |
// Contributors:
|
|
12 |
//
|
|
13 |
// Description:
|
|
14 |
//
|
|
15 |
|
|
16 |
|
|
17 |
#include "TelephonyISVExamples.h"
|
|
18 |
#include "CMainMenu.h"
|
|
19 |
|
|
20 |
/**
|
|
21 |
Real main function.
|
|
22 |
*/
|
|
23 |
void MainL(CConsoleBase& aConsole)
|
|
24 |
{
|
|
25 |
CMainMenu* menu = CMainMenu::NewLC(aConsole);
|
|
26 |
menu->Start();
|
|
27 |
|
|
28 |
// Start the active scheduler
|
|
29 |
CActiveScheduler::Start();
|
|
30 |
CleanupStack::PopAndDestroy(menu);
|
|
31 |
}
|
|
32 |
|
|
33 |
/**
|
|
34 |
Console harness.
|
|
35 |
*/
|
|
36 |
void ConsoleMainL()
|
|
37 |
{
|
|
38 |
// Get a console
|
|
39 |
CConsoleBase* aConsole = Console::NewL(_L("Telephony ISV API Example"),
|
|
40 |
TSize(KConsFullScreen,
|
|
41 |
KConsFullScreen));
|
|
42 |
CleanupStack::PushL(aConsole);
|
|
43 |
CActiveScheduler* sched = new(ELeave) CActiveScheduler();
|
|
44 |
|
|
45 |
// Push the active scheduler object onto the cleanup stack.
|
|
46 |
CleanupStack::PushL(sched);
|
|
47 |
|
|
48 |
// Install active scheduler
|
|
49 |
CActiveScheduler::Install(sched);
|
|
50 |
|
|
51 |
// Call function
|
|
52 |
MainL(*aConsole);
|
|
53 |
|
|
54 |
aConsole->Printf(_L("[ Press any key to end ]"));
|
|
55 |
aConsole->Getch();
|
|
56 |
|
|
57 |
// Finished with console
|
|
58 |
CleanupStack::PopAndDestroy(sched);
|
|
59 |
CleanupStack::PopAndDestroy(aConsole);
|
|
60 |
}
|
|
61 |
|
|
62 |
/**
|
|
63 |
Cleanup stack harness.
|
|
64 |
*/
|
|
65 |
GLDEF_C TInt E32Main()
|
|
66 |
{
|
|
67 |
__UHEAP_MARK;
|
|
68 |
CTrapCleanup* cleanupStack = CTrapCleanup::New();
|
|
69 |
TRAPD(error, ConsoleMainL());
|
|
70 |
__ASSERT_ALWAYS(!error, User::Panic(_L("Console main error\n"), error));
|
|
71 |
delete cleanupStack;
|
|
72 |
__UHEAP_MARKEND;
|
|
73 |
return KErrNone;
|
|
74 |
}
|
|
75 |
|