|
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: This file contains the implementations of the |
|
15 * CHtiFramework class. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include "HtiFramework.h" |
|
22 #include "HtiLogging.h" |
|
23 #include <badesca.h> |
|
24 #include <e32std.h> |
|
25 #include <f32file.h> |
|
26 #include <HtiCfg.h> |
|
27 #include <HtiStartupWaitInterface.h> |
|
28 |
|
29 // CONSTANTS |
|
30 _LIT( KHtiFrameworkMatchPattern, "HtiFramework*" ); |
|
31 _LIT( KHtiMainThreadName, "HtiMain" ); |
|
32 _LIT( KHtiWatchDogExeName, "HtiWatchDog.exe" ); |
|
33 _LIT( KHtiWatchDogMatchPattern, "HtiWatchDog*" ); |
|
34 _LIT( KHtiAdminStartParameter, "admin" ); |
|
35 _LIT( KEComServerMatchPattern, "EComServer*" ); |
|
36 _LIT( KHtiStartupWaitDllName, "HtiStartupWait.dll" ); |
|
37 |
|
38 // config file parameters |
|
39 _LIT( KCfgFilePath, "\\"); |
|
40 _LIT( KHtiCfgFileName, "hti.cfg" ); |
|
41 _LIT8( KCommPlugin, "CommPlugin" ); |
|
42 _LIT8( KMaxMsgSize, "MaxMsgSize" ); |
|
43 _LIT8( KMaxQueueSize, "MaxQueueSize" ); |
|
44 _LIT8( KMaxHeapSize, "MaxHeapSize" ); |
|
45 _LIT8( KPriority, "Priority" ); |
|
46 _LIT8( KShowConsole, "ShowConsole" ); |
|
47 _LIT8( KMaxWaitTime, "MaxWaitTime" ); |
|
48 _LIT8( KStartUpDelay, "StartUpDelay" ); |
|
49 _LIT8( KEnableHtiWatchDog, "EnableHtiWatchDog" ); |
|
50 _LIT8( KEnableHtiAutoStart, "EnableHtiAutoStart" ); |
|
51 _LIT8( KShowErrorDialogs, "ShowErrorDialogs" ); |
|
52 |
|
53 const static TInt KDefaultMaxWaitTime = 90; // seconds |
|
54 const static TInt KDefaultStartUpDelay = 5; // seconds |
|
55 const static TInt KHtiDefaultPriority = 3; |
|
56 const static TInt KHtiWatchDogEnabledDefault = 0; |
|
57 const static TInt KHtiConsoleEnabledDefault = 0; |
|
58 const static TInt KHtiAutoStartEnabledDefault = 0; |
|
59 const static TInt KHtiShowErrorDialogsDefault = 1; |
|
60 |
|
61 // MACROS |
|
62 |
|
63 // LOCAL CONSTANTS AND MACROS |
|
64 |
|
65 // MODULE DATA STRUCTURES |
|
66 |
|
67 // LOCAL FUNCTION PROTOTYPES |
|
68 |
|
69 // FORWARD DECLARATIONS |
|
70 |
|
71 // ============================ MEMBER FUNCTIONS =============================== |
|
72 |
|
73 // ----------------------------------------------------------------------------- |
|
74 // CHtiFramework::CHtiFramework |
|
75 // Constructor |
|
76 // ----------------------------------------------------------------------------- |
|
77 CHtiFramework::CHtiFramework(): |
|
78 iCfg( NULL ), |
|
79 iDispatcher( NULL ), |
|
80 iOriginalHeap( NULL ) |
|
81 { |
|
82 } |
|
83 |
|
84 |
|
85 // ----------------------------------------------------------------------------- |
|
86 // CHtiFramework::ConstructL |
|
87 // Second phase constructor |
|
88 // ----------------------------------------------------------------------------- |
|
89 void CHtiFramework::ConstructL() |
|
90 { |
|
91 HTI_LOG_FUNC_IN("CHtiFramework::ConstructL"); |
|
92 |
|
93 if ( IsHtiRunning() ) |
|
94 { |
|
95 HTI_LOG_TEXT( "HTI already running - not starting second instance" ); |
|
96 User::Leave( KErrAlreadyExists ); |
|
97 } |
|
98 |
|
99 TInt priority = KHtiDefaultPriority; |
|
100 TInt enableHtiWatchDog = KHtiWatchDogEnabledDefault; |
|
101 TInt showConsole = KHtiConsoleEnabledDefault; |
|
102 TInt enableHtiAutoStart = KHtiAutoStartEnabledDefault; |
|
103 TInt showErrorDialogs = KHtiShowErrorDialogsDefault; |
|
104 |
|
105 TRAPD( err, iCfg = CHtiCfg::NewL() ); |
|
106 if ( err == KErrNone ) |
|
107 { |
|
108 HTI_LOG_TEXT( "CHtiCfg constructed" ); |
|
109 TRAP( err, iCfg->LoadCfgL( KCfgFilePath, KHtiCfgFileName ) ); |
|
110 if ( err == KErrNone ) |
|
111 { |
|
112 HTI_LOG_TEXT( "Cfg file loaded" ); |
|
113 |
|
114 TBuf8<64> commPlugin( KNullDesC8 ); |
|
115 TRAPD( paramErr, commPlugin = iCfg->GetParameterL( KCommPlugin ) ); |
|
116 if ( paramErr != KErrNone ) |
|
117 { |
|
118 HTI_LOG_TEXT( "The following parameter not defined in cfg, using default value:" ); |
|
119 HTI_LOG_DES( KCommPlugin ); |
|
120 } |
|
121 |
|
122 TInt maxMsgSize = 0; |
|
123 TRAP( paramErr, maxMsgSize = iCfg->GetParameterIntL( KMaxMsgSize ) ); |
|
124 if ( paramErr != KErrNone ) |
|
125 { |
|
126 HTI_LOG_TEXT( "The following parameter not defined in cfg, using default value:" ); |
|
127 HTI_LOG_DES( KMaxMsgSize ); |
|
128 } |
|
129 |
|
130 TInt maxQueueSize = 0; |
|
131 TRAP( paramErr, maxQueueSize = iCfg->GetParameterIntL( KMaxQueueSize ) ); |
|
132 if ( paramErr != KErrNone ) |
|
133 { |
|
134 HTI_LOG_TEXT( "The following parameter not defined in cfg, using default value:" ); |
|
135 HTI_LOG_DES( KMaxQueueSize ); |
|
136 } |
|
137 |
|
138 TInt maxHeapSize = 0; |
|
139 TRAP( paramErr, maxHeapSize = iCfg->GetParameterIntL( KMaxHeapSize ) ); |
|
140 if ( paramErr != KErrNone ) |
|
141 { |
|
142 HTI_LOG_TEXT( "The following parameter not defined in cfg, using default value:" ); |
|
143 HTI_LOG_DES( KMaxHeapSize ); |
|
144 } |
|
145 else |
|
146 { |
|
147 //create new heap and switch heaps |
|
148 RHeap* newHeap = UserHeap::ChunkHeap( NULL, //local |
|
149 KMinHeapSize, //min size |
|
150 maxHeapSize //max size |
|
151 ); |
|
152 if ( newHeap ) |
|
153 { |
|
154 HTI_LOG_TEXT( "SwitchHeap" ); |
|
155 iOriginalHeap = User::SwitchHeap( newHeap ); |
|
156 HTI_LOG_ALLOC_HEAP_MEM(); |
|
157 } |
|
158 else |
|
159 { |
|
160 HTI_LOG_TEXT( "Failed create new heap" ); |
|
161 User::Leave( KErrNoMemory ); |
|
162 } |
|
163 } |
|
164 |
|
165 TRAP( paramErr, priority = iCfg->GetParameterIntL( KPriority ) ); |
|
166 if ( paramErr != KErrNone ) |
|
167 { |
|
168 HTI_LOG_TEXT( "The following parameter not defined in cfg, using default value:" ); |
|
169 HTI_LOG_DES( KPriority ); |
|
170 } |
|
171 |
|
172 TRAP( paramErr, showConsole = iCfg->GetParameterIntL( KShowConsole ) ); |
|
173 if ( paramErr != KErrNone ) |
|
174 { |
|
175 HTI_LOG_TEXT( "The following parameter not defined in cfg, using default value:" ); |
|
176 HTI_LOG_DES( KShowConsole ); |
|
177 } |
|
178 |
|
179 TInt maxWaitTime = KDefaultMaxWaitTime; |
|
180 TRAP( paramErr, maxWaitTime = iCfg->GetParameterIntL( KMaxWaitTime ) ); |
|
181 if ( paramErr != KErrNone ) |
|
182 { |
|
183 HTI_LOG_TEXT( "The following parameter not defined in cfg, using default value:" ); |
|
184 HTI_LOG_DES( KMaxWaitTime ); |
|
185 } |
|
186 |
|
187 TInt startUpDelay = KDefaultStartUpDelay; |
|
188 TRAP( paramErr, startUpDelay = iCfg->GetParameterIntL( KStartUpDelay ) ); |
|
189 if ( paramErr != KErrNone ) |
|
190 { |
|
191 HTI_LOG_TEXT( "The following parameter not defined in cfg, using default value:" ); |
|
192 HTI_LOG_DES( KStartUpDelay ); |
|
193 } |
|
194 |
|
195 TRAP( paramErr, enableHtiWatchDog = iCfg->GetParameterIntL( KEnableHtiWatchDog ) ); |
|
196 if ( paramErr != KErrNone ) |
|
197 { |
|
198 HTI_LOG_TEXT( "The following parameter not defined in cfg, using default value:" ); |
|
199 HTI_LOG_DES( KEnableHtiWatchDog ); |
|
200 } |
|
201 |
|
202 TRAP( paramErr, enableHtiAutoStart = iCfg->GetParameterIntL( KEnableHtiAutoStart ) ); |
|
203 if ( paramErr != KErrNone ) |
|
204 { |
|
205 HTI_LOG_TEXT( "The following parameter not defined in cfg, using default value:" ); |
|
206 HTI_LOG_DES( KEnableHtiAutoStart ); |
|
207 } |
|
208 |
|
209 TRAP( paramErr, showErrorDialogs = iCfg->GetParameterIntL( KShowErrorDialogs ) ); |
|
210 if ( paramErr != KErrNone ) |
|
211 { |
|
212 HTI_LOG_TEXT( "The following parameter not defined in cfg, using default value:" ); |
|
213 HTI_LOG_DES( KShowErrorDialogs ); |
|
214 } |
|
215 |
|
216 if ( !IsStartAcceptedL( enableHtiAutoStart ) ) |
|
217 { |
|
218 User::Leave( KErrAbort ); |
|
219 } |
|
220 |
|
221 WaitNormalState( maxWaitTime, startUpDelay ); |
|
222 iDispatcher = CHtiDispatcher::NewL( commPlugin, maxMsgSize, |
|
223 maxQueueSize, showConsole != 0, showErrorDialogs != 0 ); |
|
224 } |
|
225 } |
|
226 |
|
227 |
|
228 // cfg file was not found or it could not be opened |
|
229 if ( err ) |
|
230 { |
|
231 HTI_LOG_TEXT( "Error loading cfg file, use default values" ); |
|
232 |
|
233 if ( !IsStartAcceptedL( enableHtiAutoStart ) ) |
|
234 { |
|
235 User::Leave( KErrAbort ); |
|
236 } |
|
237 |
|
238 WaitNormalState( KDefaultMaxWaitTime, KDefaultStartUpDelay ); |
|
239 |
|
240 //create with default values |
|
241 iDispatcher = CHtiDispatcher::NewL( |
|
242 KNullDesC8, 0, 0, showConsole != 0, showErrorDialogs != 0 ); |
|
243 } |
|
244 |
|
245 HTI_LOG_FORMAT( "Priority setting = %d", priority ); |
|
246 // Set HTI priority |
|
247 switch ( priority ) |
|
248 { |
|
249 case 1: |
|
250 RProcess().SetPriority( EPriorityBackground ); // 250 |
|
251 break; |
|
252 case 2: |
|
253 RProcess().SetPriority( EPriorityForeground ); // 350 |
|
254 break; |
|
255 // case 3: goes to default |
|
256 case 4: |
|
257 RThread().SetPriority( EPriorityAbsoluteHigh ); // 500 |
|
258 break; |
|
259 default: |
|
260 RProcess().SetPriority( EPriorityHigh ); // 450 |
|
261 break; |
|
262 } |
|
263 |
|
264 // start hti watchdog, if it is enabled in config file |
|
265 if ( enableHtiWatchDog != 0 ) StartHtiWatchDogL(); |
|
266 |
|
267 HTI_LOG_FORMAT( "Process priority %d", RProcess().Priority() ); |
|
268 HTI_LOG_FORMAT( "Thread priority %d", RThread().Priority() ); |
|
269 HTI_LOG_FUNC_OUT("CHtiFramework::ConstructL"); |
|
270 } |
|
271 |
|
272 |
|
273 // ----------------------------------------------------------------------------- |
|
274 // CHtiFramework::~CHtiFramework |
|
275 // Destructor. |
|
276 // ----------------------------------------------------------------------------- |
|
277 CHtiFramework::~CHtiFramework() |
|
278 { |
|
279 HTI_LOG_FUNC_IN("~CHTIServer"); |
|
280 delete iDispatcher; |
|
281 |
|
282 HTI_LOG_ALLOC_HEAP_MEM(); |
|
283 //switch before deleting iCfg |
|
284 //'cause iCfg was allocated in the original heap |
|
285 if ( iOriginalHeap ) |
|
286 { |
|
287 User::SwitchHeap( iOriginalHeap ); |
|
288 } |
|
289 |
|
290 delete iCfg; |
|
291 HTI_LOG_FUNC_OUT("~CHTIServer"); |
|
292 } |
|
293 |
|
294 |
|
295 // ----------------------------------------------------------------------------- |
|
296 // CHtiFramework::NewL |
|
297 // Two-phased constructor. |
|
298 // ----------------------------------------------------------------------------- |
|
299 CHtiFramework* CHtiFramework::NewL() |
|
300 { |
|
301 CHtiFramework* obj = new ( ELeave ) CHtiFramework; |
|
302 CleanupStack::PushL( obj ); |
|
303 obj->ConstructL(); |
|
304 CleanupStack::Pop(); |
|
305 return obj; |
|
306 } |
|
307 |
|
308 |
|
309 // ----------------------------------------------------------------------------- |
|
310 // CHtiFramework::StartL |
|
311 // The method that gets the show going. |
|
312 // ----------------------------------------------------------------------------- |
|
313 TInt CHtiFramework::StartL() |
|
314 { |
|
315 HTI_LOG_FUNC_IN( "CHtiFramework::StartL" ); |
|
316 |
|
317 CConsoleBase* console = iDispatcher->GetConsole(); |
|
318 if ( console ) |
|
319 { |
|
320 console->Printf( _L( "HTI up and running.\n" ) ); |
|
321 } |
|
322 |
|
323 // start scheduler |
|
324 CActiveScheduler::Start(); |
|
325 |
|
326 HTI_LOG_FUNC_OUT( "CHtiFramework::StartL" ); |
|
327 return KErrNone; |
|
328 |
|
329 } |
|
330 |
|
331 |
|
332 // ----------------------------------------------------------------------------- |
|
333 // CHtiFramework::StartHtiWatchDogL |
|
334 // Launches the HTI Watchdog process if necessary. |
|
335 // ----------------------------------------------------------------------------- |
|
336 void CHtiFramework::StartHtiWatchDogL() |
|
337 { |
|
338 HTI_LOG_FUNC_IN( "CHtiFramework::StartHtiWatchDogL" ); |
|
339 |
|
340 TFullName processName; |
|
341 TFindProcess finder( KHtiWatchDogMatchPattern ); |
|
342 TInt err = finder.Next( processName ); |
|
343 if ( err == KErrNone ) |
|
344 { |
|
345 // ok, already running |
|
346 HTI_LOG_TEXT( "HtiWatchDog already running" ); |
|
347 } |
|
348 else |
|
349 { |
|
350 // start watchdog |
|
351 HTI_LOG_TEXT( "Starting HtiWatchDog..." ); |
|
352 RProcess watchDogProcess; |
|
353 err = watchDogProcess.Create( KHtiWatchDogExeName, KNullDesC ); |
|
354 if ( err == KErrNone ) |
|
355 { |
|
356 watchDogProcess.Resume(); |
|
357 watchDogProcess.Close(); |
|
358 HTI_LOG_TEXT( "HtiWatchDog up and running" ); |
|
359 } |
|
360 else |
|
361 { |
|
362 HTI_LOG_FORMAT( "Could not start HtiWatchDog, err: %d", err ); |
|
363 User::Leave( err ); |
|
364 } |
|
365 } |
|
366 HTI_LOG_FUNC_OUT( "CHtiFramework::StartHtiWatchDogL" ); |
|
367 } |
|
368 |
|
369 |
|
370 // ----------------------------------------------------------------------------- |
|
371 // CHtiFramework::WaitNormalState |
|
372 // Delays HTI startup until device reaches normal state. |
|
373 // ----------------------------------------------------------------------------- |
|
374 void CHtiFramework::WaitNormalState( TInt aMaxWaitTime, TInt aStartUpDelay ) |
|
375 { |
|
376 HTI_LOG_FUNC_IN("CHtiFramework::WaitNormalState"); |
|
377 // First make sure that EComServer is running before continuing |
|
378 TFullName processName; |
|
379 TFindProcess finder( KEComServerMatchPattern ); |
|
380 while ( finder.Next( processName ) != KErrNone ) |
|
381 { |
|
382 HTI_LOG_TEXT( "HTI waiting for EComServer startup" ); |
|
383 finder.Find( KEComServerMatchPattern ); |
|
384 User::After( 1000000 ); // wait 1 second |
|
385 } |
|
386 HTI_LOG_TEXT( "EComServer process found - HTI startup continuing" ); |
|
387 |
|
388 if ( aMaxWaitTime > 0 ) |
|
389 { |
|
390 TInt err = KErrNone; |
|
391 RFs fs; |
|
392 err = fs.Connect(); |
|
393 if ( err == KErrNone ) |
|
394 { |
|
395 RLibrary library; |
|
396 err = library.Load( KHtiStartupWaitDllName ); |
|
397 HTI_LOG_FORMAT( "StartupWait library load returned %d", err ); |
|
398 if ( err == KErrNone && |
|
399 library.Type()[1] == KHtiStartupWaitInterfaceUid ) |
|
400 { |
|
401 HTI_LOG_TEXT( "StartupWait DLL found" ); |
|
402 TLibraryFunction entry = library.Lookup( 1 ); |
|
403 if ( entry != NULL ) |
|
404 { |
|
405 MHtiStartupWaitInterface* startupWait = |
|
406 ( MHtiStartupWaitInterface* ) entry(); |
|
407 err = startupWait->WaitForStartup( aMaxWaitTime ); |
|
408 HTI_LOG_FORMAT( "StartupWait returned %d", err ); |
|
409 delete startupWait; |
|
410 startupWait = NULL; |
|
411 } |
|
412 } |
|
413 library.Close(); |
|
414 } |
|
415 } |
|
416 |
|
417 HTI_LOG_FORMAT( "HTI Starting after %d seconds", aStartUpDelay ); |
|
418 User::After( aStartUpDelay * 1000 * 1000 ); |
|
419 |
|
420 HTI_LOG_FUNC_OUT( "CHtiFramework::WaitNormalState" ); |
|
421 } |
|
422 |
|
423 |
|
424 // ----------------------------------------------------------------------------- |
|
425 // CHtiFramework::IsHtiRunning |
|
426 // Checks whether HTI Framework process is already running. |
|
427 // ----------------------------------------------------------------------------- |
|
428 TBool CHtiFramework::IsHtiRunning() |
|
429 { |
|
430 HTI_LOG_FUNC_IN( "CHtiFramework::IsHtiRunning" ); |
|
431 TInt htiInstanceCount = 0; |
|
432 TBool isRunning = EFalse; |
|
433 TFullName processName; |
|
434 TFindProcess finder( KHtiFrameworkMatchPattern ); |
|
435 TInt err = finder.Next( processName ); |
|
436 while ( err == KErrNone && processName.Length() > 0 ) |
|
437 { |
|
438 HTI_LOG_FORMAT( "Found process %S", &processName ); |
|
439 RProcess process; |
|
440 err = process.Open( finder ); |
|
441 if ( err == KErrNone ) |
|
442 { |
|
443 if ( process.ExitType() == EExitPending ) |
|
444 { |
|
445 HTI_LOG_TEXT( "Process is running" ); |
|
446 htiInstanceCount++; |
|
447 } |
|
448 process.Close(); |
|
449 } |
|
450 err = finder.Next( processName ); |
|
451 } |
|
452 if ( htiInstanceCount > 1 ) |
|
453 { |
|
454 isRunning = ETrue; |
|
455 } |
|
456 HTI_LOG_FUNC_OUT( "CHtiFramework::IsHtiRunning" ); |
|
457 return isRunning; |
|
458 } |
|
459 |
|
460 |
|
461 // ----------------------------------------------------------------------------- |
|
462 // CHtiFramework::IsStartAccepted |
|
463 // Checks whether HTI Framework should start or not. If automatic startup is |
|
464 // disabled HTI should start only when started by HtiAdmin. |
|
465 // ----------------------------------------------------------------------------- |
|
466 TBool CHtiFramework::IsStartAcceptedL( TBool aIsAutoStartEnabled ) |
|
467 { |
|
468 HTI_LOG_FUNC_IN( "CHtiFramework::IsStartAccepted" ); |
|
469 TBool isStartAccepted = EFalse; |
|
470 |
|
471 if ( aIsAutoStartEnabled ) |
|
472 { |
|
473 // If auto start is enabled, no additional checks needed. OK to start. |
|
474 isStartAccepted = ETrue; |
|
475 } |
|
476 |
|
477 else |
|
478 { |
|
479 // If we have "admin" parameter given from command line, start is |
|
480 // requested by HtiAdmin or HtiWatchDog and we are OK to start - |
|
481 // otherwise this is an auto start and we deny it. |
|
482 TInt cmdLen = User::CommandLineLength(); |
|
483 HBufC* cmdLine = HBufC::NewL( cmdLen ); |
|
484 TPtr ptrCmdLine = cmdLine->Des(); |
|
485 User::CommandLine( ptrCmdLine ); |
|
486 TLex parser( *cmdLine ); |
|
487 parser.SkipCharacters(); |
|
488 if ( parser.MarkedToken().Compare( KHtiAdminStartParameter ) == 0 ) |
|
489 { |
|
490 isStartAccepted = ETrue; |
|
491 } |
|
492 delete cmdLine; |
|
493 cmdLine = NULL; |
|
494 } |
|
495 |
|
496 HTI_LOG_FORMAT( "HTI start accepted = %d", isStartAccepted ); |
|
497 HTI_LOG_FUNC_OUT( "CHtiFramework::IsStartAccepted" ); |
|
498 return isStartAccepted; |
|
499 } |
|
500 |
|
501 |
|
502 // ============================ LOCAL FUNCTIONS =============================== |
|
503 |
|
504 LOCAL_C TInt StartL() |
|
505 { |
|
506 User::__DbgMarkStart( RHeap::EUser ); |
|
507 |
|
508 User::RenameThread( KHtiMainThreadName ); |
|
509 |
|
510 TInt error; |
|
511 CHtiFramework* server = NULL; |
|
512 TRAP( error, server = CHtiFramework::NewL() ); |
|
513 |
|
514 if ( error == KErrNone ) |
|
515 { |
|
516 CleanupStack::PushL( server ); |
|
517 TRAP( error, server->StartL() ); |
|
518 |
|
519 if ( error ) |
|
520 { |
|
521 HTI_LOG_FORMAT( "Leave happened in StartL(): %d", error ); |
|
522 } |
|
523 |
|
524 CleanupStack::PopAndDestroy(); |
|
525 } |
|
526 else |
|
527 { |
|
528 HTI_LOG_FORMAT( "Leave when constructing: %d", error ); |
|
529 } |
|
530 |
|
531 User::__DbgMarkEnd( RHeap::EUser, 0 ); |
|
532 HTI_LOG_TEXT( "NO memory leaks: past __UHEAP_MARKEND" ); |
|
533 return error; |
|
534 } |
|
535 |
|
536 |
|
537 GLDEF_C TInt E32Main() |
|
538 { |
|
539 __UHEAP_MARK; |
|
540 HTI_LOG_ALLOC_HEAP_MEM(); |
|
541 |
|
542 _LIT( KHTIServer, "CHtiFramework" ); |
|
543 CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
544 CActiveScheduler *scheduler = new ( ELeave ) CActiveScheduler; |
|
545 CActiveScheduler::Install( scheduler ); |
|
546 |
|
547 TRAPD( error, StartL() ); |
|
548 |
|
549 delete scheduler; |
|
550 delete cleanup; |
|
551 __UHEAP_MARKEND; |
|
552 HTI_LOG_ALLOC_HEAP_MEM(); |
|
553 |
|
554 __ASSERT_ALWAYS( !error, User::Panic( KHTIServer, error ) ); |
|
555 return KErrNone; |
|
556 } |