|
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 // System includes |
|
19 #include <e32std.h> |
|
20 #include <e32test.h> |
|
21 #include <f32file.h> |
|
22 #include <e32base.h> |
|
23 #include <e32cons.h> |
|
24 #include <f32file.h> |
|
25 #include <bacline.h> |
|
26 |
|
27 // Engine includes |
|
28 #include <memspy/engine/memspyengine.h> |
|
29 |
|
30 // User includes |
|
31 #include "ConsoleMenu.h" |
|
32 #include "ConsoleConstants.h" |
|
33 |
|
34 |
|
35 // --------------------------------------------------------------------------- |
|
36 // DoMainL() |
|
37 // |
|
38 // |
|
39 // --------------------------------------------------------------------------- |
|
40 static void DoMainL() |
|
41 { |
|
42 // Scheduler |
|
43 CActiveScheduler* scheduler = new CActiveScheduler(); |
|
44 CActiveScheduler::Install( scheduler ); |
|
45 CleanupStack::PushL( scheduler ); |
|
46 |
|
47 // F32 |
|
48 RFs fsSession; |
|
49 User::LeaveIfError( fsSession.Connect() ); |
|
50 CleanupClosePushL( fsSession ); |
|
51 |
|
52 // Console |
|
53 CConsoleBase* console = Console::NewL( KMemSpyConsoleName, TSize( KConsFullScreen, KConsFullScreen ) ); |
|
54 CleanupStack::PushL( console ); |
|
55 |
|
56 // Engine |
|
57 CMemSpyEngine* engine = CMemSpyEngine::NewL( fsSession ); |
|
58 CleanupStack::PushL( engine ); |
|
59 |
|
60 // Menu & event handler AO |
|
61 CMemSpyConsoleMenu::NewLC( *engine, *console ); |
|
62 |
|
63 // Play nicely with external processes |
|
64 RProcess::Rendezvous( KErrNone ); |
|
65 |
|
66 // Start wait loop - console will stop it when done. |
|
67 CActiveScheduler::Start(); |
|
68 |
|
69 // Tidy up |
|
70 CleanupStack::PopAndDestroy( 5, scheduler ); |
|
71 } |
|
72 |
|
73 |
|
74 |
|
75 // --------------------------------------------------------------------------- |
|
76 // E32Main() |
|
77 // |
|
78 // |
|
79 // --------------------------------------------------------------------------- |
|
80 GLDEF_C TInt E32Main() |
|
81 { |
|
82 __UHEAP_MARK; |
|
83 RDebug::Print(_L("[MCon] E32Main() - MEMSPY CONSOLE")); |
|
84 |
|
85 CTrapCleanup* cleanupTrap = CTrapCleanup::New(); |
|
86 TRAPD(err, DoMainL()); |
|
87 if ( err != KErrNone ) |
|
88 { |
|
89 RDebug::Printf( " " ); |
|
90 RDebug::Printf( " " ); |
|
91 RDebug::Print(_L("[MCon] E32Main() - MEMSPY CONSOLE - error: %d"), err); |
|
92 if ( err == KErrAlreadyExists ) |
|
93 { |
|
94 RDebug::Printf( "\t\t [MCon] NB: MemSpy and MemSpyConsoleUi cannot run simultaneously!", err); |
|
95 RDebug::Printf( " " ); |
|
96 RDebug::Printf( " " ); |
|
97 } |
|
98 } |
|
99 delete cleanupTrap; |
|
100 |
|
101 __UHEAP_MARKEND; |
|
102 |
|
103 return KErrNone; |
|
104 } |
|
105 |