1 /* |
|
2 * Copyright (c) 2005-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 |
|
19 #include <e32base.h> |
|
20 #include <e32cons.h> |
|
21 #include <e32std.h> |
|
22 |
|
23 /*@{*/ |
|
24 const TInt KDefaultInterval = 5000000; |
|
25 _LIT(KPromptPressAnyKey, "And press any key to continue..."); |
|
26 _LIT(KPromptConsole, "TEF"); |
|
27 _LIT(KPromptMMCMessage, "After hitting a key to continue, eject and insert the MMC card (press F5 and release on the emulator).\n"); |
|
28 /*@}*/ |
|
29 |
|
30 |
|
31 LOCAL_C void MainL() |
|
32 /** |
|
33 * Secure variant, contain the prompt console |
|
34 */ |
|
35 { |
|
36 CConsoleBase *console = Console::NewL(KPromptConsole, |
|
37 TSize(KConsFullScreen,KConsFullScreen)); |
|
38 CleanupStack::PushL(console); |
|
39 |
|
40 console->Printf(KPromptMMCMessage); |
|
41 console->Printf(KPromptPressAnyKey); |
|
42 |
|
43 TRequestStatus timerStatus; |
|
44 RTimer timer; |
|
45 CleanupClosePushL(timer); |
|
46 timer.CreateLocal(); |
|
47 timer.After(timerStatus, TTimeIntervalMicroSeconds32(KDefaultInterval)); |
|
48 |
|
49 TRequestStatus readStatus; |
|
50 console->Read(readStatus); |
|
51 |
|
52 User::WaitForRequest(timerStatus, readStatus); |
|
53 if ( timerStatus!=KErrNone ) |
|
54 { |
|
55 timer.Cancel(); |
|
56 User::WaitForRequest(timerStatus); |
|
57 } |
|
58 if ( readStatus==KRequestPending ) |
|
59 { |
|
60 console->ReadCancel(); |
|
61 User::WaitForRequest(readStatus); |
|
62 } |
|
63 |
|
64 CleanupStack::PopAndDestroy(2, console); |
|
65 } |
|
66 |
|
67 |
|
68 GLDEF_C TInt E32Main() |
|
69 /** |
|
70 * @return - Standard Epoc error code on process exit |
|
71 * Secure variant only |
|
72 * Process entry point. Called by client using RProcess API |
|
73 */ |
|
74 { |
|
75 CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
76 if(cleanup == NULL) |
|
77 { |
|
78 RProcess::Rendezvous(KErrNoMemory); |
|
79 return KErrNoMemory; |
|
80 } |
|
81 #if (defined TRAP_IGNORE) |
|
82 TRAP_IGNORE(MainL()); |
|
83 RProcess::Rendezvous(KErrNone); |
|
84 #else |
|
85 TRAPD(err,MainL()); |
|
86 RProcess::Rendezvous(err); |
|
87 #endif |
|
88 |
|
89 delete cleanup; |
|
90 return KErrNone; |
|
91 } |
|