|
1 /* |
|
2 * Copyright (c) 2002-2006 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: Entry point for DevEncStarter |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <c32comm.h> |
|
20 #include "DevEncStarterEngine.h" |
|
21 #include "DevEncLog.h" |
|
22 |
|
23 // LITERALS |
|
24 _LIT( KDevEncStarterName, "DevEncStarter" ); |
|
25 |
|
26 // LOCAL FUNCTION PROTOTYPES |
|
27 static void StartDevEncStarterL(); |
|
28 |
|
29 // ============================= LOCAL FUNCTIONS ============================== |
|
30 |
|
31 // ---------------------------------------------------------------------------- |
|
32 // Entry-point for the USB Watcher. |
|
33 // ---------------------------------------------------------------------------- |
|
34 // |
|
35 TInt E32Main() |
|
36 { |
|
37 DFLOG( "DevEncStarter => E32Main" ); |
|
38 TInt ret; |
|
39 |
|
40 // rename the thread so it is easy to find the panic application |
|
41 ret = User::RenameThread( KDevEncStarterName ); |
|
42 |
|
43 if (ret == KErrNone) |
|
44 { |
|
45 __UHEAP_MARK; |
|
46 // create clean-up stack |
|
47 CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
48 |
|
49 TRAP( ret, StartDevEncStarterL() ); |
|
50 |
|
51 delete cleanup; // destroy clean-up stack |
|
52 __UHEAP_MARKEND; |
|
53 } |
|
54 |
|
55 DFLOG( "DevEncStarter => E32Main ended" ); |
|
56 return ret; // and return |
|
57 } |
|
58 |
|
59 // ---------------------------------------------------------------------------- |
|
60 // Constructs and installs the active scheduler, constructs USB Watcher's |
|
61 // objects. |
|
62 // ---------------------------------------------------------------------------- |
|
63 // |
|
64 static void StartDevEncStarterL() |
|
65 { |
|
66 DFLOG( "DevEncStarter => StartDevEncStarterL" ); |
|
67 CActiveScheduler* activeScheduler = new (ELeave) CActiveScheduler(); |
|
68 CleanupStack::PushL( activeScheduler ); |
|
69 CActiveScheduler::Install( activeScheduler ); |
|
70 |
|
71 // Create the engine |
|
72 CDevEncStarterEngine* engine = CDevEncStarterEngine::NewLC(); |
|
73 |
|
74 // Start the active scheduler, the active scheduler is stopped |
|
75 // by the engine, when the phone is shutting down. |
|
76 CActiveScheduler::Start(); |
|
77 |
|
78 // Cleanup. |
|
79 CleanupStack::PopAndDestroy( engine ); |
|
80 CleanupStack::PopAndDestroy( activeScheduler ); |
|
81 DFLOG( "DevEncStarter => StartDevEncStarterL ended" ); |
|
82 } |
|
83 |
|
84 // End of file |