blob: a90ea1678e786e9df3330d755bd141469fce0c0d [file] [log] [blame]
Benny Prijonoba5926a2007-05-02 11:29:37 +00001//Auto-generated file. Please do not modify.
2//#include <e32cmn.h>
3
4//#pragma data_seg(".SYMBIAN")
5//__EMULATOR_IMAGE_HEADER2 (0x1000007a,0x00000000,0x00000000,EPriorityForeground,0x00000000u,0x00000000u,0x00000000,0x00000000,0x00000000,0)
6//#pragma data_seg()
7
8#include "ua.h"
9#include <stdlib.h>
10#include <pj/errno.h>
11#include <pj/os.h>
12#include <pj/log.h>
13#include <pj/unicode.h>
14#include <stdio.h>
15
16#include <e32std.h>
17
18#include <pj/os.h>
19
20#include <e32base.h>
21#include <e32std.h>
22
23
24
25// Global Variables
26CConsoleBase* console;
27static CActiveSchedulerWait *asw;
28
29
30// Local Functions
31
32LOCAL_C void MainL()
33{
34 //
35 // add your program code here, example code below
36 //
37 int rc = ua_main();
38
39 asw->AsyncStop();
40}
41
42class MyScheduler : public CActiveScheduler
43{
44public:
45 MyScheduler()
46 {}
47
48 void Error(TInt aError) const;
49};
50
51void MyScheduler::Error(TInt aError) const
52{
53 PJ_UNUSED_ARG(aError);
54}
55
56class MyTask : public CActive
57{
58public:
59 static MyTask *NewL();
60 void Start();
61
62protected:
63 MyTask();
64 void ConstructL();
65 virtual void RunL();
66 virtual void DoCancel();
67 TInt RunError(TInt aError);
68
69private:
70 RTimer timer_;
71};
72
73MyTask::MyTask()
74: CActive(EPriorityNormal)
75{
76}
77
78void MyTask::ConstructL()
79{
80 timer_.CreateLocal();
81 CActiveScheduler::Add(this);
82}
83
84MyTask *MyTask::NewL()
85{
86 MyTask *self = new (ELeave) MyTask;
87 CleanupStack::PushL(self);
88
89 self->ConstructL();
90
91 CleanupStack::Pop(self);
92 return self;
93}
94
95void MyTask::Start()
96{
97 timer_.After(iStatus, 0);
98 SetActive();
99}
100
101void MyTask::RunL()
102{
103 MainL();
104}
105
106void MyTask::DoCancel()
107{
108}
109
110TInt MyTask::RunError(TInt aError)
111{
112 PJ_UNUSED_ARG(aError);
113 return KErrNone;
114}
115
116
117LOCAL_C void DoStartL()
118{
119 // Create active scheduler (to run active objects)
120 MyScheduler* scheduler = new (ELeave) MyScheduler;
121 CleanupStack::PushL(scheduler);
122 CActiveScheduler::Install(scheduler);
123
124 MyTask *task = MyTask::NewL();
125 task->Start();
126
127 asw = new CActiveSchedulerWait;
128 asw->Start();
129
130 delete asw;
131 CleanupStack::Pop(scheduler);
132}
133
134
135// Global Functions
136GLDEF_C TInt E32Main()
137{
138 // Create cleanup stack
139 //__UHEAP_MARK;
140 CTrapCleanup* cleanup = CTrapCleanup::New();
141
142 // Create output console
143 TRAPD(createError, console = Console::NewL(_L("Console"), TSize(KConsFullScreen,KConsFullScreen)));
144 if (createError)
145 return createError;
146
147 TRAPD(startError, DoStartL());
148
149 console->Printf(_L("[press any key to close]\n"));
150 console->Getch();
151
152 delete console;
153 delete cleanup;
154 //__UHEAP_MARKEND;
155 return KErrNone;
156}
157