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