Benny Prijono | ba5926a | 2007-05-02 11:29:37 +0000 | [diff] [blame] | 1 | //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 |
| 26 | CConsoleBase* console; |
| 27 | static CActiveSchedulerWait *asw; |
| 28 | |
| 29 | |
| 30 | // Local Functions |
| 31 | |
| 32 | LOCAL_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 | |
| 42 | class MyScheduler : public CActiveScheduler |
| 43 | { |
| 44 | public: |
| 45 | MyScheduler() |
| 46 | {} |
| 47 | |
| 48 | void Error(TInt aError) const; |
| 49 | }; |
| 50 | |
| 51 | void MyScheduler::Error(TInt aError) const |
| 52 | { |
| 53 | PJ_UNUSED_ARG(aError); |
| 54 | } |
| 55 | |
| 56 | class MyTask : public CActive |
| 57 | { |
| 58 | public: |
| 59 | static MyTask *NewL(); |
| 60 | void Start(); |
| 61 | |
| 62 | protected: |
| 63 | MyTask(); |
| 64 | void ConstructL(); |
| 65 | virtual void RunL(); |
| 66 | virtual void DoCancel(); |
| 67 | TInt RunError(TInt aError); |
| 68 | |
| 69 | private: |
| 70 | RTimer timer_; |
| 71 | }; |
| 72 | |
| 73 | MyTask::MyTask() |
| 74 | : CActive(EPriorityNormal) |
| 75 | { |
| 76 | } |
| 77 | |
| 78 | void MyTask::ConstructL() |
| 79 | { |
| 80 | timer_.CreateLocal(); |
| 81 | CActiveScheduler::Add(this); |
| 82 | } |
| 83 | |
| 84 | MyTask *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 | |
| 95 | void MyTask::Start() |
| 96 | { |
| 97 | timer_.After(iStatus, 0); |
| 98 | SetActive(); |
| 99 | } |
| 100 | |
| 101 | void MyTask::RunL() |
| 102 | { |
| 103 | MainL(); |
| 104 | } |
| 105 | |
| 106 | void MyTask::DoCancel() |
| 107 | { |
| 108 | } |
| 109 | |
| 110 | TInt MyTask::RunError(TInt aError) |
| 111 | { |
| 112 | PJ_UNUSED_ARG(aError); |
| 113 | return KErrNone; |
| 114 | } |
| 115 | |
| 116 | |
| 117 | LOCAL_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 |
| 136 | GLDEF_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 | |